discord_handler.py 文件源码

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

项目:PokemonGo-Bot 作者: PokemonGoF 项目源码 文件源码
def handle_event(self, event, sender, level, formatted_msg, data):
        if self.dbot is None:
            try:
                self.bot.logger.info("Discord bot not running, Starting..")
                self.dbot = DiscordClass(self.bot, self.master, self.pokemons, self.config)
                self.dbot.connect()
                thread.start_new_thread(self.dbot.run)
            except Exception as inst:
                self.dbot = None
                self.bot.logger.error("Unable to start Discord bot; master: {}, exception: {}".format(self.master, pprint.pformat(inst)))
                return
        # prepare message to send
        msg = None
        msg = self.chat_handler.get_event(event, formatted_msg, data)
        if msg:
            self.dbot.sendMessage(to=self.master, text=msg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号