diff --git a/bot.py b/bot.py index 0cd6545..4652f1c 100644 --- a/bot.py +++ b/bot.py @@ -644,12 +644,21 @@ async def leave(ctx): await ctx.send("Left the voice channel.") else: await ctx.send("I am not in a voice channel.") + + @client.hybrid_command() -@commands.has_permissions(administrator=True) async def toggle_feature(ctx, feature: str, state: str): - """Enables or disables a feature like askmultus or vision.""" - global features + """Allows admin to enable or disable features based on user permissions.""" + user_id = ctx.author.id + user_data = load_user_data(user_id) + user_perms = user_data["permission"] + if user_perms < 8: # Nur Admins (permission level >= 8) können Funktionen aktivieren/deaktivieren + await ctx.send("You do not have the necessary permissions to toggle features.") + return + + global features + if feature.lower() not in features: await ctx.send(f"Feature {feature} not found.") return @@ -663,6 +672,9 @@ async def toggle_feature(ctx, feature: str, state: str): else: await ctx.send("Please specify 'on' or 'off'.") + await ctx.send("Please specify 'on' or 'off'.") + + @client.hybrid_command() async def version(ctx): """Displays the current version of the bot."""