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
评论列表
文章目录