Python 您如何通过dm将信息发送回作者discord.py重写
这需要上下文,没有上下文代码就没有意义 所以基本上,我们的服务器上有一个聊天,叫做69chat。如果邮件上没有69,则bot将删除该邮件。我想这样做,如果你忘记了69,它将向你发送你应该发送的消息(只是消息+69)。我试过这个:Python 您如何通过dm将信息发送回作者discord.py重写,python,discord.py,discord.py-rewrite,Python,Discord.py,Discord.py Rewrite,这需要上下文,没有上下文代码就没有意义 所以基本上,我们的服务器上有一个聊天,叫做69chat。如果邮件上没有69,则bot将删除该邮件。我想这样做,如果你忘记了69,它将向你发送你应该发送的消息(只是消息+69)。我试过这个: @bot.event async def on_message(message): await bot.process_commands(message) if message.channel.id == 757140530739150848: if '
@bot.event
async def on_message(message):
await bot.process_commands(message)
if message.channel.id == 757140530739150848:
if '69' in message.content:
return
else:
await message.delete()
member = message.author
channel = await member.create_dm()
await channel.send('Add a 69 on your message! You betray the 69 cult! Do this 3 more times and a kick will be coming your way!')
await channel.send("Here's what you should have said:")
await channel.send('{} 69'.format(message))
但是,它只是发送了以下信息:
在您的邮件中添加69!你背叛了69邪教!再这样做3次,你就会被踢到!
以下是你应该说的:
消息
是一个对象,因此要获取您发送的消息的内容,请使用消息。内容
消息
看起来像是一个您应该从中获取实际消息文本的对象,即等待频道。发送('{}69'。格式(message.content))