【发布时间】:2021-03-29 23:32:57
【问题描述】:
最近一次通话最后一次): 文件“randomgg.py”,第 1271 行,在 \u003cmodule\u003e 客户端运行(令牌) 运行中的文件“/usr/local/lib/python3.8/site-packages/discord/client.py”,第 708 行 返回future.result() 运行程序中的文件“/usr/local/lib/python3.8/site-packages/discord/client.py”,第 687 行 等待 self.start(*args, **kwargs) 文件“/usr/local/lib/python3.8/site-packages/discord/client.py”,第 651 行,开始 等待self.connect(重新连接=重新连接) 文件“/usr/local/lib/python3.8/site-packages/discord/client.py”,第 586 行,在连接中 从 None 提高 PrivilegedIntentsRequired(exc.shard_id) discord.errors.PrivilegedIntentsRequired:Shard ID None 正在请求尚未在开发人员门户中明确启用的特权意图。建议转到https://discord.com/developers/applications/ 并在您的应用程序页面中明确启用特权意图。如果这是不可能的,那么请考虑禁用特权意图。
我的代码是
import aiohttp
import discord
import asyncio
from collections import Counter
import typing
from discord.ext import commands
import os
from discord.ext.commands import has_permissions
import random
import json
from discord import Status
from asyncio import gather
from discord.utils import get
import datetime
from discord.utils import get
intents = discord.Intents.default()
intents.members = True
client = commands.Bot(command_prefix='.', intents=intents)
client.remove_command('help')
def check_if_it_is_me(ctx):
return ctx.message.author.id == 465946367622381578
@client.event
async def status_task():
while True:
await client.change_presence(status=discord.Status.idle, activity=discord.Game('status1'))
await asyncio.sleep(4)
await client.change_presence(status=discord.Status.idle, activity=discord.Game('status2'))
await asyncio.sleep(4)
await client.change_presence(status=discord.Status.idle, activity=discord.Game('status3'))
await asyncio.sleep(4)
@client.event
async def on_ready():
print(f'{client.user.name} is ready')
client.loop.create_task(status_task())
@client.event
async def on_member_join(member):
mem_join = member.joined_at
guild_create = member.created_at
join_days = (mem_join - guild_create).days
role = discord.utils.get(member.guild.roles, id=714805001918349344)
channel = discord.utils.get(member.guild.channels, id=771081754038501376)
if join_days < 10:
await channel.send(f'{role.mention} {member} is suspicious of being an alt, he joined {join_days} after creating his account. Pls keep an eye on him')
@client.event
async def on_member_remove(member):
pass
希望你能帮助我,我已经尝试了一切
【问题讨论】:
-
intents = discord.Intents.default() AttributeError: module 'discord' has no attribute 'Intents' 这就是我现在得到的错误
-
我的 discord.py 版本也是 1.5.1
-
nvm 不用等待我没有 wtf thx 的帮助
标签: python pycharm discord discord.py discord.py-rewrite