add updaterole command

This commit is contained in:
Skillet 2023-08-02 23:07:44 -04:00
parent 4675d0efbd
commit fdbe11b673

View File

@ -18,19 +18,7 @@ class Group(commands.Cog, name="group"):
def __init__(self, client: Bot): def __init__(self, client: Bot):
self.client = client self.client = client
async def baseperm(self, interaction: discord.Interaction, role: discord.Role, perms: str): async def updateRole(self, role:discord.Role):
await interaction.response.send_message("Whitelist group successfully added/updated")
if role.id in self.client.whitelistGrps.keys():
if perms is not None:
self.client.whitelistGrps[role.id].squadPerms = perms
self.client.whitelistGrps[role.id].updateGroup()
else:
log.info(f"Adding {role.name} ({role.id}) as a Whitelist role")
self.client.whitelistGrps[role.id] = config.WhitelistGroup(
name=role.name, roleID=role.id, permissions=perms
)
self.client.squadjs.connect() self.client.squadjs.connect()
membsup = [] membsup = []
for memb in role.members: for memb in role.members:
@ -49,6 +37,34 @@ class Group(commands.Cog, name="group"):
self.client.squadjs.commit() self.client.squadjs.commit()
self.client.squadjs.close() self.client.squadjs.close()
async def baseperm(self, interaction: discord.Interaction, role: discord.Role, perms: str):
await interaction.response.send_message("Whitelist group successfully added/updated")
if role.id in self.client.whitelistGrps.keys():
if perms is not None:
self.client.whitelistGrps[role.id].squadPerms = perms
self.client.whitelistGrps[role.id].updateGroup()
else:
log.info(f"Adding {role.name} ({role.id}) as a Whitelist role")
self.client.whitelistGrps[role.id] = config.WhitelistGroup(
name=role.name, roleID=role.id, permissions=perms
)
await self.updateRole(role)
@app_commands.command()
async def update(
self,
interaction: discord.Interaction,
role: discord.Role
):
if role.id in self.client.whitelistGrps.keys():
await interaction.response.send_message("updating role!")
await self.updateRole(role)
else:
await interaction.response.send_message("role not found!")
@app_commands.command() @app_commands.command()
async def add( async def add(
self, self,