feat: sticky message (#29)

This commit is contained in:
neo
2025-12-29 17:56:33 -05:00
committed by GitHub
parent 6d61482216
commit bc2cfb57d1
4 changed files with 354 additions and 13 deletions

View File

@@ -5,6 +5,11 @@ from discord.ext.commands import Context
from .baitbot import baitbot_command, BaitBotListener, has_protected_role
from .mention import MentionListener
from .stickybot import (
stickybot_command,
StickyBotListener,
has_allowed_role as has_sticky_role,
)
def _require_group_prefix(context: Context) -> bool:
@@ -35,7 +40,7 @@ class Events(commands.GroupCog, name="events"):
embed.set_author(
name="Events", icon_url="https://yes.nighty.works/raw/eW5lLm.webp"
)
embed.add_field(name="Available", value="baitbot", inline=False)
embed.add_field(name="Available", value="baitbot, stickybot", inline=False)
await context.send(embed=embed)
async def _invoke_hybrid(self, context: Context, name: str, **kwargs):
@@ -50,6 +55,11 @@ class Events(commands.GroupCog, name="events"):
async def events_group_baitbot(self, context: Context):
await self._invoke_hybrid(context, "baitbot")
@events_group.command(name="stickybot")
@has_sticky_role()
async def events_group_stickybot(self, context: Context):
await self._invoke_hybrid(context, "stickybot")
@commands.check(_require_group_prefix)
@has_protected_role()
@commands.hybrid_command(
@@ -58,6 +68,14 @@ class Events(commands.GroupCog, name="events"):
async def baitbot(self, context):
return await baitbot_command()(self, context)
@commands.check(_require_group_prefix)
@has_sticky_role()
@commands.hybrid_command(
name="stickybot", description="View sticky bot configuration and status."
)
async def stickybot(self, context):
return await stickybot_command()(self, context)
async def setup(bot) -> None:
cog = Events(bot)
@@ -69,5 +87,9 @@ async def setup(bot) -> None:
mention_listener = MentionListener(bot)
await bot.add_cog(mention_listener)
sticky_bot = StickyBotListener(bot)
await bot.add_cog(sticky_bot)
bot.logger.info("Loaded extension 'events.baitbot'")
bot.logger.info("Loaded extension 'events.mention'")
bot.logger.info("Loaded extension 'events.stickybot'")