Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -62,6 +62,7 @@ async def on_ready():
|
|
62 |
|
63 |
def update_google_sheet():
|
64 |
"""save data from HF Space -> google sheets (makes 1 API call)"""
|
|
|
65 |
data = open(csv_file, 'r').read()
|
66 |
# 1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w = live
|
67 |
# 1YJEwP7kZChI3Z2GKv4zFEfwwyQrO3zwXclv0QMrkOqA = test
|
@@ -71,7 +72,7 @@ def update_google_sheet():
|
|
71 |
|
72 |
|
73 |
scheduler = BackgroundScheduler()
|
74 |
-
scheduler.add_job(
|
75 |
scheduler.start()
|
76 |
|
77 |
|
@@ -174,9 +175,11 @@ async def add_exp(member_id):
|
|
174 |
|
175 |
# increment the old experience value (better not to replace outright)
|
176 |
old_xp = data.loc[index, 'discord_exp']
|
177 |
-
|
|
|
|
|
178 |
data.loc[index, 'discord_exp'] = new_xp # do not change column name
|
179 |
-
print(f"Record for {member} updated
|
180 |
|
181 |
# level up
|
182 |
current_level = calculate_level(new_xp)
|
|
|
62 |
|
63 |
def update_google_sheet():
|
64 |
"""save data from HF Space -> google sheets (makes 1 API call)"""
|
65 |
+
print("test")
|
66 |
data = open(csv_file, 'r').read()
|
67 |
# 1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w = live
|
68 |
# 1YJEwP7kZChI3Z2GKv4zFEfwwyQrO3zwXclv0QMrkOqA = test
|
|
|
72 |
|
73 |
|
74 |
scheduler = BackgroundScheduler()
|
75 |
+
scheduler.add_job(update_google_sheet, "interval", seconds=60)
|
76 |
scheduler.start()
|
77 |
|
78 |
|
|
|
175 |
|
176 |
# increment the old experience value (better not to replace outright)
|
177 |
old_xp = data.loc[index, 'discord_exp']
|
178 |
+
print(old_xp)
|
179 |
+
new_xp = old_xp + XP_PER_MESSAGE
|
180 |
+
print(f"new_xp = old_xp + XP_PER_MESSAGE / {new_xp} = {old_xp} + {XP_PER_MESSAGE}")
|
181 |
data.loc[index, 'discord_exp'] = new_xp # do not change column name
|
182 |
+
print(f"Record for {member} updated from {old_xp} to {new_xp} (+{XP_PER_MESSAGE}) ")
|
183 |
|
184 |
# level up
|
185 |
current_level = calculate_level(new_xp)
|