__init__.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:ehForwarderBot 作者: blueset 项目源码 文件源码
def unlink_all(self, bot, update):
        """
        Unlink all chats linked to the telegram group.
        Triggered by `/unlink_all`.

        Args:
            bot: Telegram Bot instance
            update: Message update
        """
        if update.message.chat.id == update.message.from_user.id:
            return bot.send_message(update.message.chat.id, "Send `/unlink_all` to a group to unlink all remote chats "
                                                           "from it.",
                                   parse_mode=telegram.ParseMode.MARKDOWN,
                                   reply_to_message_id=update.message.message_id)
        assocs = db.get_chat_assoc(master_uid="%s.%s" % (self.channel_id, update.message.chat.id))
        if len(assocs) < 1:
            return bot.send_message(update.message.chat.id, "No chat is linked to the group.",
                                   reply_to_message_id=update.message.message_id)
        else:
            db.remove_chat_assoc(master_uid="%s.%s" % (self.channel_id, update.message.chat.id))
            return bot.send_message(update.message.chat.id, "All chats has been unlinked from this group. (%s)" % len(assocs),
                                   reply_to_message_id=update.message.message_id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号