development #1

Merged
AllfatherHatt merged 157 commits from development into master 2025-06-14 15:47:26 +02:00
Showing only changes of commit e8e4b7e471 - Show all commits

View File

@ -490,10 +490,13 @@ class ReginaldCog(commands.Cog):
@commands.has_permissions(administrator=True)
async def allow_role(self, ctx, role: discord.Role):
async with self.config.guild(ctx.guild).allowed_roles() as allowed_roles:
if role.id not in allowed_roles:
allowed_roles.append(role.id)
await self.config.guild(ctx.guild).allowed_roles.set(allowed_roles) # Save change
await ctx.send(f"DEBUG: Role {role.id} added. Current allowed_roles: {allowed_roles}")
# ✅ Clean list of invalid roles before adding new one
valid_roles = [role_id for role_id in allowed_roles if ctx.guild.get_role(role_id)]
if role.id not in valid_roles:
valid_roles.append(role.id)
await self.config.guild(ctx.guild).allowed_roles.set(valid_roles) # Save change
await ctx.send(f"✅ Role `{role.name}` has been granted access to Reginald.")
else:
await ctx.send(f"⚠️ Role `{role.name}` already has access.")
@ -501,7 +504,6 @@ class ReginaldCog(commands.Cog):
@commands.has_permissions(administrator=True)
async def disallow_role(self, ctx, role: discord.Role):
async with self.config.guild(ctx.guild).allowed_roles() as allowed_roles:
# Remove invalid roles
valid_roles = [role_id for role_id in allowed_roles if ctx.guild.get_role(role_id)]
await self.config.guild(ctx.guild).allowed_roles.set(valid_roles)