1
Fork 0
mirror of https://github.com/allthingslinux/tux.git synced 2024-10-02 16:43:12 +00:00
tux/.archive/guild.py

50 lines
1.8 KiB
Python
Raw Permalink Normal View History

feat: Add new files guild.py, message.py, thread.py in tmp directory for event handling refactor: Move event handling code from tux/cogs/events to tmp directory for better organization fix: Comment out listeners in new files for testing purposes chore: Delete old files guild.py, member.py, message.py in tux/cogs/events as they are no longer needed chore: remove thread.py due to redundancy and lack of use feat(logging/commands.py): add new CommandEventsCog to log command usage for better tracking and debugging feat(logging): add guild logging functionality to track changes in guild This commit introduces a new file, guild.py, which contains a GuildLogging class. This class provides various listeners to track changes in the guild such as channel creation/deletion/update, guild update, emojis update, integration create/update/delete, role create/delete/update, scheduled event create/delete/update, stage instance create/delete/update, and thread create/delete/update. The changes are sent to an audit log channel. feat(logging): add new logging cogs for member, mod, and voice events This commit introduces three new cogs for logging different types of events. The MemberLogging cog logs events related to members such as joining, leaving, and updates. The ModLogging cog logs events related to moderation such as creation, update, and deletion of automod rules, as well as member bans and unbans. The VoiceLogging cog logs events related to voice channels such as voice state updates. These new cogs will help in tracking and auditing activities in the server.
2024-04-09 07:26:47 +00:00
from discord.ext import commands
class GuildEventsCog(commands.Cog, name="Guild Events Handler"):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
# @commands.Cog.listener()
# async def on_guild_channel_create(self, channel: discord.abc.GuildChannel) -> None:
# logger.trace(f"{channel} has been created in {channel.guild}.")
# @commands.Cog.listener()
# async def on_guild_channel_delete(self, channel: discord.abc.GuildChannel) -> None:
# logger.trace(f"{channel} has been deleted in {channel.guild}.")
# @commands.Cog.listener()
# async def on_guild_channel_pins_update(
# self,
# channel: discord.abc.GuildChannel | discord.Thread,
# last_pin: datetime | None,
# ) -> None:
# logger.trace(f"Pins in #{channel.name} have been updated. Last pin: {last_pin}")
# @commands.Cog.listener()
# async def on_guild_channel_update(
# self, before: discord.abc.GuildChannel, after: discord.abc.GuildChannel
# ) -> None:
# logger.trace(f"Channel updated: {before} -> {after}")
# @commands.Cog.listener()
# async def on_guild_role_create(self, role: discord.Role) -> None:
# logger.trace(f"Role created: {role}")
# @commands.Cog.listener()
# async def on_guild_role_delete(self, role: discord.Role) -> None:
# logger.trace(f"Role deleted: {role}")
# @commands.Cog.listener()
# async def on_guild_role_update(self, before: discord.Role, after: discord.Role) -> None:
# logger.trace(f"Role updated: {before} -> {after}")
# @commands.Cog.listener()
# async def on_guild_update(self, before: discord.Guild, after: discord.Guild) -> None:
# logger.trace(f"Guild updated: {before} -> {after}")
async def setup(bot: commands.Bot) -> None:
await bot.add_cog(GuildEventsCog(bot))