2 回答

TA貢獻1816條經驗 獲得超4個贊
這可以使用on_message
@bot.event
async def on_message(m):
if m.channel.id == ChannelIDOfSupport Channel:
if m.content.replace(bot.prefix, "") not in [i.name for i in bot.commands]:
await m.delete()

TA貢獻1847條經驗 獲得超11個贊
所以基本上我所做的是替換消息偵聽器的實際命令,如果它以支持執行命令開始,那么我恢復了命令功能。它看起來像這樣:
async def on_message(m):
? ? if m.channel.id == 735866701069025301:
? ? ? ? if m.content.startswith('=ticket'):
? ? ? ? ? ? await m.author.send('Your ticket will be created according to what you choose, use the = before choosing a number and then put the number next to it (Example: =2) \n \n **1. General Support** \n \n **2. Staff Application**')
? ? ? ? ? ? await m.channel.purge()
? ? ? ? else: {
? ? ? ? ? ? await m.delete()
}
? ? await client.process_commands(m)
添加回答
舉報