Merge branch 'feature/intern' of gitea.nebulo9.fr:nebulo9/botmafieux into feature/intern
This commit is contained in:
23
setup/bot.py
23
setup/bot.py
@@ -1,7 +1,5 @@
|
||||
import discord
|
||||
from discord.ext import bridge
|
||||
# from cogs.birthday import BirthdayCog
|
||||
# from cogs.productivity import ProductivityCog
|
||||
from discord.ext import commands
|
||||
from cogs.cs import CSCog
|
||||
from cogs.insult import InsultsCog
|
||||
from cogs.roulette import RouletteCog
|
||||
@@ -15,8 +13,9 @@ bot_intents.members = True
|
||||
bot_intents.presences = True
|
||||
bot_intents.guilds = True
|
||||
bot_intents.reactions = True
|
||||
bot_intents.voice_states = True
|
||||
|
||||
bot = bridge.Bot(command_prefix='$', intents=bot_intents)
|
||||
bot = commands.Bot(command_prefix='$', intents=bot_intents)
|
||||
|
||||
COG_REGISTRY = {
|
||||
'cs': CSCog,
|
||||
@@ -29,6 +28,22 @@ COG_REGISTRY = {
|
||||
from discord import option as discord_option
|
||||
|
||||
|
||||
@bot.slash_command(name="reload", description="Reload a feature (cog) by name, or 'all')")
|
||||
@discord_option(name="feature", description="Feature to reload (e.g. cs, insult, roles, roulette, all)", input_type=str, required=True)
|
||||
async def reload(ctx: discord.ApplicationContext, feature: str):
|
||||
# Only allow administrators
|
||||
if not ctx.author or not getattr(ctx.author, 'guild_permissions', None) or not ctx.author.guild_permissions.administrator:
|
||||
await ctx.respond("You must be a server administrator to use this command.", ephemeral=True)
|
||||
return
|
||||
|
||||
await ctx.defer()
|
||||
reload_feature(feature)
|
||||
await ctx.followup.send(f"Reload requested for feature: {feature}", ephemeral=True)
|
||||
|
||||
# Register a global admin slash command directly on the bot to avoid circular imports.
|
||||
from discord import option as discord_option
|
||||
|
||||
|
||||
@bot.slash_command(name="reload", description="Reload a feature (cog) by name, or 'all')")
|
||||
@discord_option(name="feature", description="Feature to reload (e.g. cs, insult, roles, roulette, all)", input_type=str, required=True)
|
||||
async def reload(ctx: discord.ApplicationContext, feature: str):
|
||||
|
||||
Reference in New Issue
Block a user