Skip to content

Commit 21be67f

Browse files
committed
i changes some certain things
1 parent 4fdd9a8 commit 21be67f

File tree

1 file changed

+6
-16
lines changed
  • modules/moderation/commands

1 file changed

+6
-16
lines changed

modules/moderation/commands/mod.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -279,20 +279,10 @@ async def banall(self, inter: disnake.ApplicationCommandInteraction):
279279
)
280280
await inter.response.send_message(embed=emb,components=[disnake.ui.Button(style=disnake.ButtonStyle.red,label="CONFIRM")])
281281

282-
async def role_autocomplete(self, inter: disnake.ApplicationCommandInteraction, string: str):
283-
# Filter the roles to only those whose ID is in the whitelist
284-
filtered_roles = [
285-
role for role in inter.guild.roles
286-
if role.id in variables.mod_edit_roles and string.lower() in role.name.lower()
287-
]
288-
289-
# Return the filtered roles as options for autocomplete
290-
return [disnake.OptionChoice(name=role.name, value=role.id) for role in filtered_roles]
291-
292282
def role_list(self):
293283
return [disnake.OptionChoice(name=role.name,value=role.id) for role in self.bot.guild.roles if role.id in variables.mod_edit_roles]
294284

295-
@mod.sub_command("role","grants or removes a (non-vital) role")
285+
@mod.sub_command("role","Grants or removes a (non-vital) role")
296286
async def role(
297287
self,
298288
inter: disnake.ApplicationCommandInteraction,
@@ -303,18 +293,18 @@ async def role(
303293
),
304294
role: disnake.Role = commands.Param()
305295
):
306-
if (not role.id in variables.mod_edit_roles):
307-
await inter.response.send_message(f"Role {role.name} is not allowed in this command", ephemeral=True)
296+
if not role.id in variables.mod_edit_roles:
297+
await inter.response.send_message(f"Role `{role.name}` is not allowed in this command", ephemeral=True)
308298
return
309299

310300
try:
311-
if (modification == "add"):
312-
if (role in user.roles):
301+
if modification == "add":
302+
if role in user.roles:
313303
await inter.response.send_message(f"User {user.name} already has the role {role}.", ephemeral=True)
314304
else:
315305
await user.add_roles(role)
316306
else:
317-
if (role in user.roles):
307+
if role in user.roles:
318308
await user.remove_roles(role)
319309
else:
320310
await inter.response.send_message(f"User {user.name} doesn't have the role {role}.", ephemeral=True)

0 commit comments

Comments
 (0)