尝试创建dm mod邮件机器人,并在我发送邮件时不停地发送相同的邮件。
代码:
def check(message):
return message.author
@bot.event
async def on_message(message):
await bot.process_commands(message)
await bot.wait_for('message', check=check)
await message.channel.send("Thanks for your message! Our staff team will reply to you as soon as possible.",delete_after=10)
if message.author.bot:
breakpoint
e=bot.get_channel(746784415086149662)
await e.send(f"**{message.author}**\n"
f"{message.content}\n")
图片:
答案 0 :(得分:2)
确保消息的作者不是机器人本身还是其他机器人:
def check(message):
return message.author
@bot.event
async def on_message(message):
if message.author.bot:
return
await bot.process_commands(message)
await bot.wait_for('message', check=check)
await message.channel.send("Thanks for your message! Our staff team will reply to you as soon as possible.",delete_after=10)
if not message.author.bot:
e=bot.get_channel(746784415086149662)
await e.send(f"**{message.author}**\n"
f"{message.content}\n")
您有breakpoint
不会退出该功能。