lunarflu HF staff commited on
Commit
3c44710
1 Parent(s): 8a13292

safetychecks (only I can use commands for now)

Browse files
Files changed (1) hide show
  1. app.py +22 -20
app.py CHANGED
@@ -60,31 +60,33 @@ def calculate_level(xp):
60
 
61
  @bot.command()
62
  async def level(ctx):
63
- author_id = str(ctx.author.id)
64
- if author_id in xp_data:
65
- xp = xp_data[author_id]
66
- level = calculate_level(xp)
67
- await ctx.send(f'You are at level {level} with {xp} XP.')
68
- else:
69
- await ctx.send('You have not earned any XP yet.')
 
70
 
71
 
72
  @bot.command()
73
  async def count(ctx):
74
  """Count total messages per user in all channels."""
75
- message_counts = {}
76
-
77
- for channel in ctx.guild.text_channels:
78
- try:
79
- async for message in channel.history(limit=None):
80
- message_counts[message.author] = message_counts.get(message.author, 0) + 1
81
- except discord.Forbidden:
82
- # Handle the Forbidden error
83
- await ctx.send(f"Missing access to read messages in {channel.name}")
84
-
85
- sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
86
- top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users])
87
- await ctx.send(f"Message count per user in all text channels:\n{top_list}")
 
88
 
89
 
90
  """"""
 
60
 
61
  @bot.command()
62
  async def level(ctx):
63
+ if ctx.author.id == 811235357663297546:
64
+ author_id = str(ctx.author.id)
65
+ if author_id in xp_data:
66
+ xp = xp_data[author_id]
67
+ level = calculate_level(xp)
68
+ await ctx.send(f'You are at level {level} with {xp} XP.')
69
+ else:
70
+ await ctx.send('You have not earned any XP yet.')
71
 
72
 
73
  @bot.command()
74
  async def count(ctx):
75
  """Count total messages per user in all channels."""
76
+ if ctx.author.id == 811235357663297546:
77
+ message_counts = {}
78
+
79
+ for channel in ctx.guild.text_channels:
80
+ try:
81
+ async for message in channel.history(limit=None):
82
+ message_counts[message.author] = message_counts.get(message.author, 0) + 1
83
+ except discord.Forbidden:
84
+ # Handle the Forbidden error
85
+ await ctx.send(f"Missing access to read messages in {channel.name}")
86
+
87
+ sorted_users = sorted(message_counts.items(), key=lambda x: x[1], reverse=True)
88
+ top_list = "\n".join([f"{member.name}: {count}" for member, count in sorted_users])
89
+ await ctx.send(f"Message count per user in all text channels:\n{top_list}")
90
 
91
 
92
  """"""