似乎我的命令在 Discord.py 中不起作用

时间:2021-04-25 02:20:42

标签: python discord.py botframework

命令被执行,尽管终端说命令不存在。 不知道发生了什么,因为这是我的第一个不和谐机器人,我知道一点 python,所以很抱歉占用你们的时间,真的。

谢谢你的帮助!

import discord
from discord.ext import commands


bot = commands.Bot(command_prefix= ':')
game = discord.Game("with the API")
#list of banned words
filtered_words = ['bad words']
@bot.event
async def on_ready():
    print("Hello I am online and ready!")

bot.run('token')

#Group message clearing
@bot.command(aliases=['c'])
@commands.has_permissions(manage_messages = True)
async def clear(ctx, amount=1):
        await ctx.channel.purge(Limit = amount)
        await ctx.reply(f'Deleted {clear} messages')

#auto mod
@bot.event
async def on_message(msg):
    for word in filtered_words:
        if word in msg.context:
            await msg.delete()
    await bot.process_commands(msg)

@bot.event
async def on_disconnect():
    print("I seem to be getting disconnected, one minute!")

@bot.event
async def on_member_join(memeber):
    print(f'Weclome {memeber} to the server, please enjoy your stay!')

@bot.event
async def on_message_delete(msg):
    msg.send(" <:raysQ:835686467844964395> ")

1 个答案:

答案 0 :(得分:1)

bot.run 部分应位于文件末尾。它是循环的入口点。

另外,请在其他人使用之前重新生成您的令牌。