【发布时间】:2020-05-25 01:21:33
【问题描述】:
我的 Discord 服务器上有一个名为#pay-respecc 的频道。这里的目标是让人们在不滥用系统的麻烦制造者的情况下支付他们的尊重。我试图做到这一点,所以如果你在频道中发送了不是“f”的东西,它会被删除,并且机器人会向你发送警告。虽然它似乎不起作用。有任何想法吗?错误是TypeError: on_message() missing 1 required positional argument: 'ctx。
@client.event
async def on_message(message, ctx):
if message.content != "f" and message.channel.id == 699364974014890044:
await message.delete()
embed = discord.Embed(
title = 'Paying respeccs',
description = 'Please do not abuse your ability to pay respeccs. To pay respecc the correct way, please send `f`. Any other message will be deleted and reviewed by the staff team in the case of offendable messages.',
color = discord.Color.from_rgb(r=159, g=255, b=255)
)
embed.set_footer(text='{}' .format(ctx.author))
await ctx.author.send(embed=embed)
print(f"Deleted '{message.content}' on channel #payrespecc by {message.author}. Warning message has been sent!")
await client.process_commands(message)
【问题讨论】:
标签: python discord discord.py