传递了不正确的令牌 [英] Improper token passed

查看:23
本文介绍了传递了不正确的令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 YouTube 上关注 Python Discord 机器人的基本教程,我的代码在下面.它说:

I'm following a basic tutorial for a Python Discord bot on YouTube and my code is underneath. It says:

discord.errors.LoginFailure:通过了不正确的令牌.

discord.errors.LoginFailure: Improper token has been passed.

在任何人问之前,是的,我已经输入了机器人令牌,而不是 id 或秘密.

Before anyone asks, yes I have put in the bot token, not the id or secret.

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")

推荐答案

确保你拿到了Token"来自机器人"Discord 开发站点中的页面,而不是秘密"页面.来自一般信息";页面.

Make sure you grab the "Token" from the "Bot" page in the Discord development site, rather than the "Secret" from the "General Information" page.

我遇到了同样的问题.通过使用 Discord 应用页面中的正确令牌解决了我的问题.我使用的是秘密".从一般信息"页面(它为我在原始帖子中生成错误)而不是令牌"页面来自机器人"页面.

I was having the same problem. My issue was solved by using the correct token from the Discord app page. I was using the "Secret" from the 'General Information' page (which generated the error in the original post for me) instead of the "Token" from the "Bot" page.

正如 sheneb 在对此的评论中所说,这个答案(可能)不会帮助 OP(因为现在的问题是在有人问之前,是的,我已经输入了 bot 令牌,而不是 id 或秘密".).但是,我在搜索答案时发现了这个问题/页面,我的问题通过这些信息得到了解决.

As sheneb said in the comment to this, this answer (probably) won't help the OP (since the question now says "Before anyone asks, yes I have put in the bot token, not the id or secret"). However, I found this question/page when searching for the answer, and my issue was solved with this information.

这篇关于传递了不正确的令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆