EmperorFred/libs/Cog.py
2025-12-05 20:21:47 -06:00

24 lines
678 B
Python

from __future__ import annotations
import discord
from discord.ext import commands as discord_commands
class Cog(discord_commands.Cog):
"""Lightweight wrapper around discord.py's Cog used across bots.
Provides a typed `bot` attribute on instances.
"""
def __init__(self, bot: discord_commands.Bot) -> None:
self.bot: discord_commands.Bot = bot
self.messages_deletable = False
@discord_commands.Cog.listener()
async def on_ready(self):
print(f"{self.__name__} is ready")
async def delete_message(self, interaction: discord.Interaction):
if self.messages_deletable:
await interaction.message.delete()