我正在尝试为已删除的消息创建一个记录器,每当消息被删除时,都会根据一个事件来记录
snipe_message_author = None
snipe_message_id = None
@client.event
async def on_message_delete(message):
global snipe_message_content
global snipe_message_author
global snipe_message_id
snipe_message_content = message.content
snipe_message_author = message.author.id
snipe_message_id = message.id
await asyncio.sleep(60)
if message.id == snipe_message_id:
snipe_message_author = None
snipe_message_content = None
snipe_message_id = None
@client.event
async def logs(ctx, message):
if snipe_message_content==None:
m == 1
else:
embed = discord.Embed(description=f"{snipe_message_content}")
embed.set_footer(text=f"Sniped by {message.author.name}#{message.author.discriminator}")
embed.set_author(name= f"<@{snipe_message_author}>")
await message.channel.send(client.get_channel('channel id'), embed=embed)
return
我在这部分遇到问题....
@client.event
async def logs(ctx, message):
if snipe_message_content==None:
m == 1
else:
embed = discord.Embed(description=f"{snipe_message_content}")
embed.set_footer(text=f"Sniped by {message.author.name}#{message.author.discriminator}")
embed.set_author(name= f"<@{snipe_message_author}>")
await message.channel.send(client.get_channel('channnelid'), embed=embed)
return
我尝试过使用不同的方法,但到目前为止都没有效果
答案 0 :(得分:0)
你需要一个命令?
@client.command()
async def logs(ctx):
global snipe_message_content
if snipe_message_content==None:
m = 1
else:
embed = discord.Embed(description=f"{snipe_message_content}")
embed.set_footer(text=f"Sniped by {ctx.author.name}#{ctx.author.discriminator}")
embed.set_author(name= f"<@{snipe_message_author}>")
await ctx.send(embed=embed)