bot.py 文件源码

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

项目:PlasmaBot 作者: PlasmaRobotics2403 项目源码 文件源码
def safe_send_message(self, dest, content, *, tts=False, expire_in=0, also_delete=None):
        msg = None
        try:
            msg = await self.send_message(dest, content, tts=tts)

            if msg and expire_in:
                asyncio.ensure_future(self._wait_delete_msg(msg, expire_in))

            if also_delete and isinstance(also_delete, discord.Message):
                asyncio.ensure_future(self._wait_delete_msg(also_delete, expire_in))

        except discord.Forbidden:
            if self.config.debug:
                print('[PB][PERMISSIONS] Cannot send message to {0}, no permission'.format(dest.name))

        except discord.NotFound:
            if self.config.debug:
                print('[PB][CHANNEL] Cannot send message to {0}, channel does not exist'.format(dest.name))

        return msg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号