【发布时间】:2022-01-23 17:43:26
【问题描述】:
我收到这样的错误:
Traceback (most recent call last):
File "E:\AS-TEAM\cp\public\hello.py", line 22, in <module>
bot.run("thisistokensorry:(", Bot=False)
File "E:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "E:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "E:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 663, in start
raise TypeError("unexpected keyword argument(s) %s" % list(kwargs.keys()))
TypeError: unexpected keyword argument(s) ['Bot']
那么,我该如何修复它? python代码为:
import discord
import time
from discord.ext import commands
bot = commands.Bot(command_prefix='$')
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content.find("!Hello") != -1:
await message.channel.send('Hi')
if message.content.lower().startswith('message everyone'):
for guild in bot.guilds:
await time.sleep(.25)
members = guild.members
for member in members:
if member.bot is True:
continue
await time.sleep(.25)
channel = await member.create_dm()
await channel.send('sup')
bot.run("thisistokensorry:(", Bot=False)
而且,我需要帮助。因为我想第一次把它修好! 请修复它
【问题讨论】:
-
Bot=False是什么意思?根据您的Traceback,最近的错误是在第 22 行提出的。 -
您还应该重新生成令牌,因为在您的第一个代码 sn-p 中您输入了
OTE3MDEwODg4NDYzMTAxOTcy.YbYDRg.mQBQUp0xetLY1q-unG8MmsOTcgs复制粘贴 Traceback。
标签: discord.py