Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
count users with role
Browse files
app.py
CHANGED
|
@@ -327,6 +327,7 @@ async def update_leaderboard(ctx, num_results: int = 10): # needs rewrite
|
|
| 327 |
except Exception as e:
|
| 328 |
print(f"on_message Error: {e}")
|
| 329 |
|
|
|
|
| 330 |
@bot.command(name='xp_help')
|
| 331 |
async def xp_help(ctx):
|
| 332 |
try:
|
|
@@ -334,6 +335,13 @@ async def xp_help(ctx):
|
|
| 334 |
await ctx.author.send(help_message)
|
| 335 |
except Exception as e:
|
| 336 |
print(f"on_message Error: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
|
| 338 |
|
| 339 |
|
|
|
|
| 327 |
except Exception as e:
|
| 328 |
print(f"on_message Error: {e}")
|
| 329 |
|
| 330 |
+
|
| 331 |
@bot.command(name='xp_help')
|
| 332 |
async def xp_help(ctx):
|
| 333 |
try:
|
|
|
|
| 335 |
await ctx.author.send(help_message)
|
| 336 |
except Exception as e:
|
| 337 |
print(f"on_message Error: {e}")
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
@bot.command()
|
| 341 |
+
async def count_users_with_role(ctx, role_id):
|
| 342 |
+
role = discord.utils.get(ctx.guild.roles, id=int(role_id))
|
| 343 |
+
count = sum(1 for member in ctx.guild.members if role in member.roles)
|
| 344 |
+
await ctx.send(f"Number of users with the role '{role.name}': {count}")
|
| 345 |
|
| 346 |
|
| 347 |
|