在控制台中安装bot时出现discord错误



我正在为discord编写一个机器人程序,一切都很好,过了一段时间,它在控制台的控制台中出现了错误

我认为错误在令牌中,因为所有的代码都正确工作

删除并重新下载discord.py更新的py -3 -m pip install -U discord.py但没有任何帮助

告诉我还能做什么?我将附上以下代码:

import os
import sys
import asyncio
import time
import json
from discord.ext import commands
from discord.utils import get
bot = commands.Bot(command_prefix = '!', intents=discord.Intents.all())
TOKEN = 'My token'
>Bot code that worked without errors<
#Connect
token = open('token.txt', 'r').readline()
bot.run(token)

我添加了两个版本的令牌:通过文本文件和通过token = ''的代码

intents=discord.Intents.all()这是一个严肃的声明,你确定你真的需要所有的意图吗?如果是这样,你确定你启用了discord-dev门户上的所有意图吗?那条线可能会给你带来问题,试着把它删除。

最新更新