Python 在Discord.py事件中遇到问题
我一直在使用Python进行bot开发,但最近我遇到了一些在操作发生时不会触发的事件问题。 像这样的事件:Python 在Discord.py事件中遇到问题,python,discord,discord.py,Python,Discord,Discord.py,我一直在使用Python进行bot开发,但最近我遇到了一些在操作发生时不会触发的事件问题。 像这样的事件:关于_会员_删除#我尝试了两种#,关于_公会(u角色)删除,关于_公会(u频道)删除 我想知道它们为什么不起作用,如果你知道它们为什么不起作用,我将感谢你的帮助 from discord.ext.commands import Bot, Greedy from discord import user import discord from discord.ext import command
关于_会员_删除
#我尝试了两种#,关于_公会(u角色)删除
,关于_公会(u频道)删除
我想知道它们为什么不起作用,如果你知道它们为什么不起作用,我将感谢你的帮助
from discord.ext.commands import Bot, Greedy
from discord import user
import discord
from discord.ext import commands
from discord.ext.commands import Bot, has_permissions, MissingPermissions
import asyncio
intents = discord.Intents()
intents.members = True
bot = commands.Bot(command_prefix="/", help_command=None, intents=intents)
@bot.event
async def on_ready():
await bot.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="TEST"))
print('Hello :|')
@bot.event
async def on_member_remove(member):
print("on_member_kick Worked")
@bot.event
async def on_guild_role_delete(role):
print("on_role_delete Worked")
@bot.event
async def on_guild_channel_delete(channel):
print("on_channel_delete Worked")
哦,天哪,如果你看一下 成员上的
\u kick
、角色上的和频道上的删除事件根本不存在。
可能的替代方案有:
关于成员的删除
(根据文档应该是有效的)
on\u guild\u channel\u delete
on\u guild\u role\u delete
此外,请检查您是否已启用“开发人员”页面上的意图,这可能是导致“删除成员”事件中的不起作用的原因。谢谢您的提示,但这也不起作用。