Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
@@ -205,8 +205,6 @@ async def on_message(message):
|
|
205 |
row_number = cell.row
|
206 |
column_number = cell.col
|
207 |
"""
|
208 |
-
|
209 |
-
|
210 |
except Exception as e:
|
211 |
print(f"Error: {e}")
|
212 |
|
@@ -215,107 +213,6 @@ async def on_message(message):
|
|
215 |
except Exception as e:
|
216 |
print(f"Error: {e}")
|
217 |
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
@bot.command()
|
223 |
-
async def restore_exp(ctx):
|
224 |
-
if ctx.author.id == 811235357663297546:
|
225 |
-
try:
|
226 |
-
guild = ctx.guild
|
227 |
-
lvl1 = guild.get_role(1171861537699397733)
|
228 |
-
lvl2 = guild.get_role(1171861595115245699)
|
229 |
-
lvl3 = guild.get_role(1171861626715115591)
|
230 |
-
lvl4 = guild.get_role(1171861657975259206)
|
231 |
-
lvl5 = guild.get_role(1171861686580412497)
|
232 |
-
lvl6 = guild.get_role(1171861900301172736)
|
233 |
-
lvl7 = guild.get_role(1171861936258941018)
|
234 |
-
lvl8 = guild.get_role(1171861968597024868)
|
235 |
-
lvl9 = guild.get_role(1171862009982242836)
|
236 |
-
lvl10 = guild.get_role(1164188093713223721)
|
237 |
-
lvl11 = guild.get_role(1171524944354607104)
|
238 |
-
lvl12 = guild.get_role(1171524990257082458)
|
239 |
-
lvl13 = guild.get_role(1171525021928263791)
|
240 |
-
lvl14 = guild.get_role(1171525062201966724)
|
241 |
-
lvl15 = guild.get_role(1171525098465918996)
|
242 |
-
|
243 |
-
|
244 |
-
level_roles = [lvl1,lvl2,lvl3,lvl4,lvl5,lvl6,lvl7,lvl8,lvl9,lvl10,lvl11,lvl12,lvl13,lvl14,lvl15]
|
245 |
-
|
246 |
-
member_id_column_values = worksheet.col_values(1)
|
247 |
-
|
248 |
-
for role in level_roles:
|
249 |
-
role_members = [member.id for member in ctx.guild.members if role in member.roles]
|
250 |
-
|
251 |
-
# role = position in level_roles + some adjustment factor
|
252 |
-
# list of people in a given role (e.g. lvl5)
|
253 |
-
print(f"role: {role} | role_members: {role_members}")
|
254 |
-
|
255 |
-
#members_with_role = [member.id for member in ctx.guild.members if lvl13 in member.roles]
|
256 |
-
# extract user_id + xp based on level
|
257 |
-
for member_id in role_members:
|
258 |
-
string_member_id = str(member_id)
|
259 |
-
if string_member_id in member_id_column_values:
|
260 |
-
continue
|
261 |
-
|
262 |
-
member = await bot.fetch_user(member_id)
|
263 |
-
#xp = calculate_xp(13)
|
264 |
-
position = level_roles.index(role) + 1
|
265 |
-
xp = calculate_xp(position)
|
266 |
-
level = calculate_level(xp+1)
|
267 |
-
print(f"{role} {level} {xp} {member}")
|
268 |
-
|
269 |
-
string_xp = str(xp)
|
270 |
-
string_level = str(level)
|
271 |
-
|
272 |
-
# get column name / data to safetycheck
|
273 |
-
|
274 |
-
|
275 |
-
# does a record already exist?
|
276 |
-
cell = worksheet.find(string_member_id)
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
#if cell is None:
|
281 |
-
print(f"creating new record for {member}")
|
282 |
-
# if not, create new record
|
283 |
-
length = len(worksheet.col_values(1))
|
284 |
-
worksheet.update(values=[[string_member_id, member.name, xp, level]], range_name=f'A{length+1}:D{length+1}')
|
285 |
-
"""
|
286 |
-
cell = worksheet.cell(length+1,1)
|
287 |
-
worksheet.update_cell(length+1, 1, string_member_id)
|
288 |
-
worksheet.update_cell(length+1, 2, member.name)
|
289 |
-
worksheet.update_cell(length+1, 3, string_xp)
|
290 |
-
worksheet.update_cell(length+1, 4, string_level)
|
291 |
-
"""
|
292 |
-
|
293 |
-
|
294 |
-
else:
|
295 |
-
if cell:
|
296 |
-
continue
|
297 |
-
|
298 |
-
print(f"updating record for {member}")
|
299 |
-
# if so, update that row...
|
300 |
-
# update exp, can only be in a positive direction
|
301 |
-
worksheet.update(values=[[xp, level]], range_name=f'C{cell.row}:D{cell.row}')
|
302 |
-
|
303 |
-
#worksheet.update_cell(cell.row, cell.col+2, xp)
|
304 |
-
#worksheet.update_cell(cell.row, cell.col+3, level)
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
"""
|
309 |
-
value = cell.value
|
310 |
-
row_number = cell.row
|
311 |
-
column_number = cell.col
|
312 |
-
"""
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
except Exception as e:
|
317 |
-
print(f"Error: {e}")
|
318 |
-
|
319 |
|
320 |
@bot.command()
|
321 |
async def fixsheets(ctx):
|
|
|
205 |
row_number = cell.row
|
206 |
column_number = cell.col
|
207 |
"""
|
|
|
|
|
208 |
except Exception as e:
|
209 |
print(f"Error: {e}")
|
210 |
|
|
|
213 |
except Exception as e:
|
214 |
print(f"Error: {e}")
|
215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
@bot.command()
|
218 |
async def fixsheets(ctx):
|