@commands.Cog.listener()
async def on_guild_channel_update(self, before, after):
guild = after.guild
async for f in guild.audit_logs(limit=1, action=discord.AuditLogAction.channel_update):
if f!=None:
euser=f.user
if not guild.me.guild_permissions.administrator or euser==guild.owner or f.user.top_role.position>=guild.me.top_role.position:
return
d = {"ctype": "channel-update", "target": before}
if handle_antinuke(self, guild, 'channel_update', d):
global wl, default_whitelist
if not smart_wl(guild, euser, discord.AuditLogAction.channel_update) and euser != guild.owner and not euser.id in default_whitelist:
try:
await messages.nukep(self, euser, "Попытка краша сервера (обновление каналов)")
except:
pass
try:
if after==discord.TextChannel or discord.CategoryChannel:
await after.edit(
permissions=before.permissions,
before_name=before.name,
nsfw=before.nsfw,
topic=before.topic,
slowmode_delay=before.slowmode_delay
)
elif after==discord.VoiceChannel:
await after.edit(
permissions=before.permissions,
before_name=before.name,
nsfw=before.nsfw,
bitrate=before.bitrate,
user_limit=before.user_limit,
region_override=before.region_override
)
except Exception as e:
print(e)
if euser.bot:
await who_added(self.bot, guild, euser)>