为什么“机器人”无效。在我的discord.py代码中

时间:2020-05-20 23:30:57

标签: discord.py

bot = commands.Bot(command_prefix=prefix, self_bot=True)

    @commands.check(self_check)
    @bot.command(pass_context=True)
    async def mall(ctx, *, message):
        await ctx.message.delete()
        for user in ctx.guild.members:
            try:
                await user.send(message)
                print(f"{user.name} has recieved the message.")
            except:
                print(f"{user.name} has NOT recieved the message.")
        print("Action Completed: mall")

bot.run(token, bot=False)

我遇到这样的问题: invalid syntax (<unknown>, line 45)

为什么“机器人”语法无效。我不明白

2 个答案:

答案 0 :(得分:0)

您实际上需要做一个前缀... prefix='Enter prefix here'

bot.run(token, bot=False)必须为bot.run('Enter token here')

答案 1 :(得分:0)

  1. 我们不知道什么是“第45行”
  2. 您没有定义“令牌”和“前缀”
  3. 从未见过像self_bot=Truebot=False这样的参数
相关问题