Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
replacing startswith with [] for integers
Browse files
app.py
CHANGED
|
@@ -242,11 +242,11 @@ async def add_exp(member_id):
|
|
| 242 |
# str -> int temporarily
|
| 243 |
new_xp = int(old_xp) + XP_PER_MESSAGE
|
| 244 |
# check + convert back to string + google sheet proofing
|
| 245 |
-
if not new_xp
|
| 246 |
new_xp = f"L" + str(new_xp) + f"L"
|
| 247 |
|
| 248 |
# add back to dataframe in memory after checking redundantly;
|
| 249 |
-
if new_xp
|
| 250 |
global_df.loc[index, 'discord_exp'] = new_xp # do not change column name
|
| 251 |
print(f"Record for {member} updated from {old_xp} to {global_df.loc[index, 'discord_exp']} (+{XP_PER_MESSAGE}) ")
|
| 252 |
|
|
@@ -354,7 +354,7 @@ async def add_exp(member_id):
|
|
| 354 |
print(f"Creating new record for {member}")
|
| 355 |
|
| 356 |
xp = 10 # define somewhere else?
|
| 357 |
-
if not xp
|
| 358 |
xp = f"L" + str(xp) + f"L"
|
| 359 |
member_id = str(member_id)
|
| 360 |
if not member_id.startswith("L") and not member_id.endswith("L"):
|
|
|
|
| 242 |
# str -> int temporarily
|
| 243 |
new_xp = int(old_xp) + XP_PER_MESSAGE
|
| 244 |
# check + convert back to string + google sheet proofing
|
| 245 |
+
if not new_xp[0] == "L" and not new_xp[-1] == "L":
|
| 246 |
new_xp = f"L" + str(new_xp) + f"L"
|
| 247 |
|
| 248 |
# add back to dataframe in memory after checking redundantly;
|
| 249 |
+
if new_xp[0] == "L" and new_xp[-1] == "L":
|
| 250 |
global_df.loc[index, 'discord_exp'] = new_xp # do not change column name
|
| 251 |
print(f"Record for {member} updated from {old_xp} to {global_df.loc[index, 'discord_exp']} (+{XP_PER_MESSAGE}) ")
|
| 252 |
|
|
|
|
| 354 |
print(f"Creating new record for {member}")
|
| 355 |
|
| 356 |
xp = 10 # define somewhere else?
|
| 357 |
+
if not xp[0] == "L" and not xp[-1] == "L":
|
| 358 |
xp = f"L" + str(xp) + f"L"
|
| 359 |
member_id = str(member_id)
|
| 360 |
if not member_id.startswith("L") and not member_id.endswith("L"):
|