【发布时间】:2021-09-28 01:49:24
【问题描述】:
Discord.py
我将尽我所能解释这一点。
如果一个类别被删除,我有一个偶数;类别被克隆。 使用已删除的频道数据,我想将频道从该原始类别移至新类别。
我目前使用的代码是:
@commands.Cog.listener()
async def on_guild_channel_delete(self,channel):
try:
logs = await channel.guild.audit_logs(limit=1, action=discord.AuditLogAction.channel_delete).flatten()
logs = logs[0]
if logs.user != channel.guild.owner:
if logs.user.id != 891409650287796295:
new = await channel.clone(reason="Anti Nuke Protection")
try:
channels = channel.channels
print(channels)
for c in channels:
try:
await c.edit(category=new)
except Exception as e:
print(e)
except Exception as e:
print(e)
except:
pass
但渠道变量返回为 [ ]
【问题讨论】:
-
只是为了确保:如果类别被删除,所有频道都会出现在顶部。您是否希望他们随后被移至新类别?另外:你的代码在做什么?您正在谈论类别和渠道。请多解释一下代码。
标签: python discord.py