lunarflu HF staff commited on
Commit
3b3c75a
1 Parent(s): dbc6eba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -65,7 +65,7 @@ processed_users = set()
65
 
66
  async def periodic_api_test():
67
  try:
68
- await asyncio.sleep(0.01)
69
  column_values_3 = worksheet2.col_values(3)
70
  column_values_8 = worksheet2.col_values(8)
71
 
@@ -138,7 +138,7 @@ def is_csv_empty(file_path):
138
 
139
  def blocking_io(member_id):
140
  try:
141
- time.sleep(0.01)
142
  worksheet = gspread_bot.open("levelbot").sheet1
143
 
144
  guild = bot.get_guild(879548962464493619)
@@ -183,7 +183,7 @@ def blocking_io(member_id):
183
 
184
  async def add_exp(member_id):
185
  try:
186
- await asyncio.sleep(0.01)
187
  loop = asyncio.get_running_loop()
188
  result = await loop.run_in_executor(None, blocking_io, member_id)
189
 
@@ -255,7 +255,7 @@ async def on_message(message):
255
  if message.author.id not in bot_ids:
256
  if "!help_xp" not in message.content:
257
  print(f"adding exp from message {message.author}")
258
- await asyncio.sleep(0.01)
259
  await add_exp(message.author.id)
260
  await periodic_api_test() # run this ~1 per day otherwise will lead to issues
261
  await bot.process_commands(message)
@@ -268,7 +268,7 @@ async def on_reaction_add(reaction, user):
268
  try:
269
  if user.id not in bot_ids:
270
  print(f"adding exp from react {user.id}")
271
- await asyncio.sleep(0.01)
272
  await add_exp(user.id)
273
  except Exception as e:
274
  print(f"on_reaction_add Error: {e}")
@@ -279,7 +279,7 @@ async def on_reaction_add(reaction, user):
279
  @bot.command(name='update_leaderboard')
280
  async def update_leaderboard(ctx, num_results: int = 10):
281
  if ctx.author.id == 811235357663297546:
282
- await asyncio.sleep(0.01)
283
  worksheet = gspread_bot.open("levelbot").sheet1
284
 
285
  names_list = worksheet.col_values(2)[1:]
 
65
 
66
  async def periodic_api_test():
67
  try:
68
+ await asyncio.sleep(1)
69
  column_values_3 = worksheet2.col_values(3)
70
  column_values_8 = worksheet2.col_values(8)
71
 
 
138
 
139
  def blocking_io(member_id):
140
  try:
141
+ time.sleep(1)
142
  worksheet = gspread_bot.open("levelbot").sheet1
143
 
144
  guild = bot.get_guild(879548962464493619)
 
183
 
184
  async def add_exp(member_id):
185
  try:
186
+ await asyncio.sleep(1)
187
  loop = asyncio.get_running_loop()
188
  result = await loop.run_in_executor(None, blocking_io, member_id)
189
 
 
255
  if message.author.id not in bot_ids:
256
  if "!help_xp" not in message.content:
257
  print(f"adding exp from message {message.author}")
258
+ await asyncio.sleep(1)
259
  await add_exp(message.author.id)
260
  await periodic_api_test() # run this ~1 per day otherwise will lead to issues
261
  await bot.process_commands(message)
 
268
  try:
269
  if user.id not in bot_ids:
270
  print(f"adding exp from react {user.id}")
271
+ await asyncio.sleep(1)
272
  await add_exp(user.id)
273
  except Exception as e:
274
  print(f"on_reaction_add Error: {e}")
 
279
  @bot.command(name='update_leaderboard')
280
  async def update_leaderboard(ctx, num_results: int = 10):
281
  if ctx.author.id == 811235357663297546:
282
+ await asyncio.sleep(1)
283
  worksheet = gspread_bot.open("levelbot").sheet1
284
 
285
  names_list = worksheet.col_values(2)[1:]