lunarflu HF staff commited on
Commit
ac906e6
1 Parent(s): 4fe0a98

some cleanup

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -187,12 +187,10 @@ async def add_exp(member_id):
187
 
188
  # increment the old experience value (better not to replace outright)
189
  old_xp = global_df.loc[index, 'discord_exp']
190
- print(old_xp)
191
  new_xp = old_xp + XP_PER_MESSAGE
192
- print(f"new_xp = old_xp + XP_PER_MESSAGE / {new_xp} = {old_xp} + {XP_PER_MESSAGE}")
193
  global_df.loc[index, 'discord_exp'] = new_xp # do not change column name
194
- print(f"Record for {member} updated from {old_xp} to {new_xp} (+{XP_PER_MESSAGE}) ")
195
- print(f"Current value: {global_df.loc[index, 'discord_exp']}")
196
 
197
  # level up
198
  current_level = calculate_level(new_xp)
@@ -207,7 +205,7 @@ async def add_exp(member_id):
207
  #print(f"{member} Level up! {current_level-1} -> {current_level}!")
208
  #if current_role in member.roles: # needs update; reference exp reward for verification
209
  #await member.send(f"Level up! {current_level-1} -> {current_level}!")
210
-
211
  if not member_found:
212
  # if not, create new record
213
  print(f"creating new record for {member}")
@@ -217,24 +215,22 @@ async def add_exp(member_id):
217
  member_id = str(member_id)
218
  member_name = str(member.name)
219
  current_level = calculate_level(xp)
220
- print(f"test")
221
  row_data = [member_id, member_name, xp, current_level]
222
- print(f"test")
223
  global_df.loc[len(global_df.index)] = row_data
224
 
225
  #new_row_df = pd.DataFrame([row_data], columns=global_df.columns)
226
  #updated_df = global_df.append(new_row_df, ignore_index=True) deprecated
227
  #updated_df = pd.concat([global_df, pd.DataFrame([new_row_df])], ignore_index=True)
228
 
229
- print(f"test")
230
  # initial role assignment
231
  if current_level == 1:
232
  if lvl1 not in member.roles:
233
  await member.add_roles(lvl1)
234
- print(f"Gave {member} {lvl1}") # can log this better
 
235
 
236
- if member_id == 811235357663297546:
237
- update_google_sheet()
238
  except Exception as e:
239
  print(f"add_exp Error: {e}")
240
 
 
187
 
188
  # increment the old experience value (better not to replace outright)
189
  old_xp = global_df.loc[index, 'discord_exp']
 
190
  new_xp = old_xp + XP_PER_MESSAGE
 
191
  global_df.loc[index, 'discord_exp'] = new_xp # do not change column name
192
+ print(f"Record for {member} updated from {old_xp} to {global_df.loc[index, 'discord_exp']} (+{XP_PER_MESSAGE}) ")
193
+
194
 
195
  # level up
196
  current_level = calculate_level(new_xp)
 
205
  #print(f"{member} Level up! {current_level-1} -> {current_level}!")
206
  #if current_role in member.roles: # needs update; reference exp reward for verification
207
  #await member.send(f"Level up! {current_level-1} -> {current_level}!")
208
+ print(f"----------------------------------------------------")
209
  if not member_found:
210
  # if not, create new record
211
  print(f"creating new record for {member}")
 
215
  member_id = str(member_id)
216
  member_name = str(member.name)
217
  current_level = calculate_level(xp)
 
218
  row_data = [member_id, member_name, xp, current_level]
 
219
  global_df.loc[len(global_df.index)] = row_data
220
 
221
  #new_row_df = pd.DataFrame([row_data], columns=global_df.columns)
222
  #updated_df = global_df.append(new_row_df, ignore_index=True) deprecated
223
  #updated_df = pd.concat([global_df, pd.DataFrame([new_row_df])], ignore_index=True)
224
 
 
225
  # initial role assignment
226
  if current_level == 1:
227
  if lvl1 not in member.roles:
228
  await member.add_roles(lvl1)
229
+ print(f"Gave {member} {lvl1}") # can log this better
230
+ print(f"----------------------------------------------------")
231
 
232
+ #if member_id == 811235357663297546:
233
+ update_google_sheet()
234
  except Exception as e:
235
  print(f"add_exp Error: {e}")
236