def on_raw_message_delete(self, message_id, channel_id):
if message_id in self._about_to_be_deleted:
# we triggered this deletion ourselves and
# we don't need to drop it from the database
self._about_to_be_deleted.discard(message_id)
return
channel = self.bot.get_channel(channel_id)
if channel is None or not isinstance(channel, discord.TextChannel):
return
starboard = await self.get_starboard(channel.guild.id)
if starboard.channel is None or starboard.channel.id != channel_id:
return
# at this point a message got deleted in the starboard
# so just delete it from the database
async with self.bot.pool.acquire() as con:
query = "DELETE FROM starboard_entries WHERE bot_message_id=$1;"
await con.execute(query, message_id)
评论列表
文章目录