【发布时间】:2019-01-07 05:09:15
【问题描述】:
我在 YouTube 上关注 Python Discord 机器人的基本教程,我的代码在下面。它说:
discord.errors.LoginFailure:通过了不正确的令牌。
在任何人问之前,是的,我已经输入了机器人令牌,而不是 id 或秘密。
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client()
client = commands.Bot(command_prefix = "!")
@client.event
async def on_ready():
print("Bot is ready!")
@client.event
async def on_message(message):
if message.content == "cookie":
await client.send_message(message.channel, ":cookie:")
client.run("token is here")
【问题讨论】:
-
确切的错误信息是什么?
-
@PatrickHaugh discord.errors.LoginFailure:通过了不正确的令牌。
-
尝试重新生成机器人令牌。确保复制/粘贴没有向字符串添加任何空格。如果不查看令牌(您不应该分享),我看不出任何人可以提供帮助。
-
client.run("token is here", bot=True)或client.run("token is here", bot=False)
标签: python token discord discord.py