def get_chat_administrators(self, chat_id): """ Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. :param chat_id: :return: """ result = apihelper.get_chat_administrators(self.token, chat_id) ret = [] for r in result: ret.append(types.ChatMember.de_json(r)) return ret
def get_chat_administrators(self, chat_id): """ Use this method to get a list of administrators in a chat. On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots. :param chat_id: :return: """ result = apihelper.get_chat_administrators(self.token, chat_id) ret = [] for r in result: ret.append(types.ChatMember.de_json(r)) return ret
def _bot_start(message): if message.chat.type == "group": admins = apihelper.get_chat_administrators(_config_.telegram_token, message.chat.id) for user in admins: if user['user']['id'] == apihelper.get_me( _config_.telegram_token)['id']: telegram_bot.send_message(message.chat.id, "Set unique id with /setid") break else: telegram_bot.send_message(message.chat.id, "Please promote me to admin") else: telegram_bot.send_message(message.chat.id, "Please add me to group")