コード例 #1
0
ファイル: message_events.py プロジェクト: vzdc/ZDC.Discord
 async def on_message_delete(self, message: Message) -> None:
     logging_channel = message.guild.get_channel(int(os.environ["LOGGING_CHANNEL"]))
     embed = Embed(
         title="Message Deleted",
         description=f"{message.author.mention}'s message in {message.channel.mention} was deleted",
         color=Color.red(),
     )
     embed.add_field(name="Message", value=message.content)
     embed.set_thumbnail(url=message.author.avatar.url)
     embed.timestamp = datetime.now()
     await logging_channel.send(embed=embed)
コード例 #2
0
ファイル: message_events.py プロジェクト: vzdc/ZDC.Discord
 async def on_message_edit(self, before: Message, after: Message) -> None:
     logging_channel = before.guild.get_channel(int(os.environ["LOGGING_CHANNEL"]))
     embed = Embed(
         title="Message Edited",
         description=f"{before.author.mention}'s message in {before.channel.mention} was edited",
         color=Color.red(),
     )
     embed.add_field(name="Before", value=before.content, inline=False)
     embed.add_field(name="After", value=after.content, inline=False)
     embed.set_thumbnail(url=before.author.avatar.url)
     embed.timestamp = datetime.now()
     await logging_channel.send(embed=embed)