modified: bot.py

This commit is contained in:
SimolZimol
2024-09-05 14:55:18 +02:00
parent 8f47e44f60
commit a59f6eefdf

18
bot.py
View File

@@ -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."""