My bot does not react to the on_guild_audit_log_entry_create in nextcord. Its set up in a cog that sends the corrosponsing audit log entry in a channel. Yes, the bot has the needed permissions (administrator).
Here’s a snipped of the code
import traceback
import asyncio
import nextcord
from nextcord.ext import commands
from static import config
from schildi import utils
import datetime
import os
from schildi import log
def user_action_embed(action: str, user: nextcord.Member, color: int, extra: str | None):
embed = nextcord.Embed(title="Audit Log Eintrag erstellt", description=action,
timestamp=datetime.datetime.now(), color=color)
embed.add_field(name="User", value=f"{user.mention} - {user.name}n||{user.id}||", inline=False)
if extra:
embed.add_field(name="Zusatz", value=extra, inline=False)
return embed
class log_listener(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_guild_audit_log_entry_create(self, entry: nextcord.AuditLogEntry):
print(entry.action)
log_channel = self.client.get_channel(config.AUDIT_LOG_CHANNEL)
if entry.action == nextcord.AuditLogAction.thread_create:
await log_channel.send(embed=user_action_embed(
action="Thread create",
user=entry.user,
extra=f"{entry.extra.channel.mention}",
color=0x3efa5e))
if entry.action == nextcord.AuditLogAction.thread_delete:
await log_channel.send(embed=user_action_embed(
action="Thread delete",
user=entry.user,
extra=f"{entry.extra.channel.mention}",
color=0x3efa5e))
if entry.action == nextcord.AuditLogAction.thread_update:
await log_channel.send(embed=user_action_embed(
action="Thread create",
user=entry.user,
extra=f"{entry.extra.channel.mention}",
color=0x3efa5e))
def setup(client):
client.add_cog(log_listener(client))
Am i doing something wrong here?
New contributor
Deutscher 775 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.