示例#1
0
    def send_tags(self, chat_id, query_chat_id):
        tags_text = ""
        chat = self.mapper.get_chat_by_id(query_chat_id)
        if not chat or len(chat.tags) == 0:
            tags_text = "No Tags found for this chat"
        else:
            tags = ["%s. %s" % (i+1, t.pretty_print()) for i, t in enumerate(chat.tags)]
            tags_text = "\n".join(tags)
            tags_text = "Tags for chat %s:\n%s" % (query_chat_id, tags_text)

        request = SendMessageRequest(chat_id, tags_text)
        response, content = request.do()
        if response.status_code != 200 or not content["ok"]:
            raise "Failed to send /tldr"
示例#2
0
 def send_warning_to_user(self, user_id, warning_text):
     request = SendMessageRequest(user_id, warning_text)
     response, content = request.do()
     if response.status_code != 200 or not content["ok"]:
         raise "Failed to send warning to user"
示例#3
0
 def process_chat_id_query(self, chat_id):
     text = "This chat's ID: {}\nUse it to call '/tldr {}'".format(chat_id, chat_id)
     request = SendMessageRequest(chat_id, text)
     response, content = request.do()
     if response.status_code != 200 or not content["ok"]:
         raise "Failed to send /help"
示例#4
0
 def process_help(self, chat_id):
     request = SendMessageRequest(chat_id, HELP)
     response, content = request.do()
     if response.status_code != 200 or not content["ok"]:
         raise "Failed to send /help"