lunarflu HF Staff commited on
Commit
4601dce
Β·
1 Parent(s): 54ac175

perms adjustments

Browse files
Files changed (1) hide show
  1. app.py +20 -3
app.py CHANGED
@@ -85,7 +85,8 @@ async def safetychecks(ctx):
85
 
86
  #βœ…βœ… check if the command is in the allowed channel(s)
87
  channel_id = 1100458786826747945
88
- if ctx.channel.id != channel_id: # #bot-test = 1100458786826747945
 
89
  print(f"If using a command, commands are not permitted in {ctx.channel}")
90
  return False
91
  else:
@@ -93,8 +94,21 @@ async def safetychecks(ctx):
93
 
94
  #βœ…βœ… check if the user has the required role(s)
95
  guild_id = 879548962464493619
96
- required_role_id = 900063512829755413 # @verified = 900063512829755413, HF = 897376942817419265
 
97
  guild = bot.get_guild(guild_id)
 
 
 
 
 
 
 
 
 
 
 
 
98
  required_role = guild.get_role(required_role_id)
99
  if required_role not in ctx.author.roles:
100
  print(f"Error: The user does not have the required role to use that command. ({required_role} is the correct role)")
@@ -102,7 +116,10 @@ async def safetychecks(ctx):
102
  else:
103
  await ctx.reply(f"βœ…{ctx.author} has the required role {required_role}")
104
 
105
- return True
 
 
 
106
 
107
  # ping lunarflu if any safety check ever fails
108
  except Exception as e:
 
85
 
86
  #βœ…βœ… check if the command is in the allowed channel(s)
87
  channel_id = 1100458786826747945
88
+ channel_ids = [1100458786826747945, 1113182673859518514]
89
+ if ctx.channel.id not in channel_ids: # #bot-test = 1100458786826747945, #testing-the-bot = 1113182673859518514
90
  print(f"If using a command, commands are not permitted in {ctx.channel}")
91
  return False
92
  else:
 
94
 
95
  #βœ…βœ… check if the user has the required role(s)
96
  guild_id = 879548962464493619
97
+ required_role_id = 900063512829755413 # @verified = 900063512829755413, HF = 897376942817419265, fellows = 963431900825919498
98
+ allowed_role_ids = [897376942817419265, 963431900825919498]
99
  guild = bot.get_guild(guild_id)
100
+ user_roles = ctx.author.roles
101
+ has_allowed_role = any(role.id in allowed_role_ids for role in user_roles)
102
+ if not has_allowed_role:
103
+ print("Error: The user does not have any of the required roles to use that command.")
104
+ return False
105
+ else:
106
+ allowed_roles = [role for role in user_roles if role.id in allowed_role_ids]
107
+ roles_str = ", ".join([role.name for role in allowed_roles])
108
+ await ctx.reply(f"βœ…{ctx.author} has the required role(s): {roles_str}")
109
+
110
+
111
+ '''
112
  required_role = guild.get_role(required_role_id)
113
  if required_role not in ctx.author.roles:
114
  print(f"Error: The user does not have the required role to use that command. ({required_role} is the correct role)")
 
116
  else:
117
  await ctx.reply(f"βœ…{ctx.author} has the required role {required_role}")
118
 
119
+ return True
120
+
121
+ '''
122
+
123
 
124
  # ping lunarflu if any safety check ever fails
125
  except Exception as e: