我的 on_member_join 事件不起作用。我尝试了意图,但它给出了这个错误

2024-05-02

考虑:

最近一次通话最后):
文件“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 行,在 start 中
等待 self.connect(重新连接=重新连接)
文件“/usr/local/lib/python3.8/site-packages/discord/client.py”,第 586 行,在连接中
从 None 引发 PrivilegedIntentsRequired(exc.shard_id)
Discord.errors.PrivilegedIntentsRequired:分片 ID None 正在请求尚未在开发人员门户中显式启用的特权意图。建议去https://discord.com/developers/applications/ 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

我怎样才能解决这个问题?


该错误确切地告诉您该怎么做。

  1. Go to https://discord.com/developers/applications https://discord.com/developers/applications
  2. 导航至您的应用程序
  3. 前往Bot section
  4. 向下滚动并启用SERVER MEMBERS INTENT
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

我的 on_member_join 事件不起作用。我尝试了意图,但它给出了这个错误 的相关文章

  • 发送自动电子邮件时安全输入密码

    这很可能是重复的 但我已经非常仔细地研究了类似的问题 This https stackoverflow com questions 28393750 secure email without prompting for password r
  • 如何将字典转换为字符串

    我正在尝试使用提供的解决方案here https stackoverflow com questions 5192753 how to get the number of occurrences of each character usin
  • SQLAlchemy 关系错误:对象没有属性“c”

    I used sql自动编码 https code google com p sqlautocode 生成我的模型和所有关系 我正在尝试做一个简单的查询 例如 obj session query Venue filter Venue sym
  • 代码运行时出现内存问题(Python、Networkx)

    我编写了一个代码来生成具有 379613734 条边的图 但由于内存问题 代码无法完成 当经过 6200 万行时 大约会占用服务器内存的 97 所以我杀了它 您有解决这个问题的想法吗 我的代码是这样的 import os sys impor
  • 我应该将Python的pyc文件添加到.dockerignore吗?

    我见过几个例子 dockerignorePython 项目的文件 其中 pyc文件和 或 pycache 文件夹被忽略 pycache pyc 由于无论如何这些文件 文件夹都会在容器中重新创建 我想知道这样做是否是一个好习惯 是的 这是一个
  • Visual Studio Code 调试控制台中的 pydevd 警告

    我已经搜索了一段时间但找不到任何相关问题 当使用 Visual Studio Code 和 Python 扩展来调试大型元素时 计算表示或获取属性可能需要一些时间 在这些情况下 会出现如下警告 pydevd 警告 计算 DataFrame
  • Python 中字典的合并层次结构

    我有两本词典 而我想做的事情有点奇怪 基本上 我想合并它们 这很简单 但它们是字典的层次结构 我想以这样的方式合并它们 如果字典中的项目本身就是字典并且存在于两者中 我也想合并这些字典 如果它不是字典 我希望第二个字典中的值覆盖第一个字典中
  • 如何检查Docker中是否安装了python包?

    我使用Dockerfile成功构建了一个容器 但是 我的代码在容器中不起作用 如果我手动安装所有软件包 它确实有效 我假设我搞砸了一些导致 docker 没有正确安装软件包的事情 所以 我想检查Docker容器中是否安装了python包 最
  • Pandas系列矢量化文本处理

    我想使用矢量化操作改进我的 Pandas 代码 假设我有一个简单的 DataFrame 其中有一个文本列 其中可能包含 url Column1 0 hello http www google com 1 bye www mail com w
  • 如何使用列表理解从列表中删除重复的项目? [复制]

    这个问题在这里已经有答案了 如何使用列表理解从列表中删除重复的项目 我有以下代码 a 1 2 3 3 5 9 6 2 8 5 2 3 5 7 3 5 8 b b item for item in a if item not in b 但它不
  • 在 Flask 中将配置文件作为字典读取

    在 instance app cfg 我已经配置 test test 在我的烧瓶文件 app py 中 with app open instance resource app cfg as f config f read print con
  • 字典键中的通配符

    假设我有一本字典 rank dict V 1 A 2 V 3 A 4 正如您所看到的 我在一个 V 的末尾添加了一个 虽然 3 可能只是 V 的值 但我想要 V1 V2 V2234432 等的另一个密钥 我想检查它 checker V30
  • 如何在 django admin 中使用自定义字段进行搜索

    我有一个模型并已注册到管理员 并且我已使用自定义字段在列表中显示 class ReportsAdmin admin ModelAdmin def investment self inst return models OrderDetail
  • 使用字符串迭代 url - python

    我现在完全被我的代码困住了 首先 我尝试从 volkskrant 的存档页面检索所有网址 这是我被打击的第一步 某一特定日期的 url 如下所示 http www volkskrant nl archief detail 01012016
  • While 在范围内循环用户输入

    我有一些代码 我想要求用户输入 1 100 之间的数字 如果他们在这些数字之间输入一个数字 它将打印 Size input 并打破循环 但是 如果他们在外部输入一个数字1 100 它将打印 大小 输入 并继续向他们重新询问一个数字 但我遇到
  • Pythonwinsound,ASYNC 标志不起作用?

    我正在使用 python 3 5 我试图在继续执行脚本的同时播放声音 根据https docs python org 3 5 library winsound html https docs python org 3 5 library w
  • Python 结构的 PHP 替代品

    我很高兴在我的 Python 项目中使用 Fabric 进行部署 现在我正在从事一个更大的 PHP 项目 想知道是否有类似 PHP 的 Fabric 之类的东西 唔 为什么这有关系 Fabric 只是 python 脚本 所以它与项目语言无
  • python 从字典中获取唯一值

    我想从我的字典中获取唯一的值 Input 320 167 316 0 319 167 401 167 319 168 380 167 265 166 期望的输出 167 0 168 166 我的代码 unique values sorted
  • 如何使用 NLP 确定句子中的中心词?

    例如 如果我得到一个句子 一名英国士兵在阿富汗战斗中丧生 这句话的中心词是 杀 给定 Python 中的 nltk 包 我怎样才能找到它 我不是在谈论词干 我指的是中心词 您正在寻找中心词句子解析 它可以在 Python 的 nltk 包中
  • Python 3d 金字塔

    我是 3D 绘图新手 我只想用 5 个点建造一个金字塔并通过它切出一个平面 我的问题是我不知道如何填充两侧 points np array 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 fig plt figure ax fi

随机推荐