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

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

问题描述

我正在关注youtube上的python discord bot的基础教程,并且我的代码位于下面。表示已通过了不正确的令牌。在有人问之前,是的,我已经输入了机器人令牌,而不是ID或秘密

I'm following a basic tutorial for a python discord bot on youtube and my code is underneath. it says an improper token has been passed. 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")


推荐答案

请确保您获取了令牌来自 Bot在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应用程序页面中的正确令牌解决了我的问题。我正在使用秘密从常规信息页面(该页面在我的原始帖子中产生了错误)而不是令牌来自 Bot

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有所帮助(因为现在的问题是在任何人问之前,是的,我有放入漫游器令牌而不是ID或secret)。但是,我在搜索答案时发现了这个问题/页面,并且此信息解决了我的问题。很高兴它对您有所帮助,gouravkr,希望对其他访问者有所帮助。

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 info. I'm glad it helped you, gouravkr, and I hope it helps others who visit.

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

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