请帮助我,我希望我的机器人发送日志(例如“用户已进入频道” 和“已删除邮件” ,”用户已加入服务器“ )在此先感谢
@commands.Cog.listener()
async def on_message_delete(self, message):
deleted = Embed(
description=f"Message deleted in {message.channel.mention}", color=0x4040EC
).set_author(name=message.author, url=Embed.Empty, icon_url=message.author.avatar_url)
deleted.add_field(name="Message", value=message.content)
deleted.timestamp = message.created_at
await channel.send(embed=deleted)
答案 0 :(得分:0)
让我们举个例子,你想在用户加入时让它记录。当然,我个人使用客户端,并且没有齿轮,因此您可以根据需要进行更改:
@client.event
async def on_user_join(self, member):
logs_channel = client.get_channel(CHANNEL_ID_HERE)
logs_channel.send(f"{member} has joined")
# you can change the welcome message of course that is an example