Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
testing
Browse files
app.py
CHANGED
@@ -54,9 +54,29 @@ def calculate_xp(level):
|
|
54 |
|
55 |
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
async def add_exp(member_id):
|
58 |
try:
|
59 |
-
worksheet = gspread_bot.open("levelbot").sheet1
|
|
|
|
|
60 |
|
61 |
print(f"1")
|
62 |
guild = bot.get_guild(879548962464493619)
|
@@ -87,9 +107,16 @@ async def add_exp(member_id):
|
|
87 |
11: lvl11, 12: lvl12, 13: lvl13, 14: lvl14, 15: lvl15, 16: lvl16, 17: lvl17, 18: lvl18, 19: lvl19, 20: lvl20,
|
88 |
}
|
89 |
print(f"2")
|
90 |
-
|
91 |
# does a record already exist?
|
92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
length = len(worksheet.col_values(1))
|
94 |
print(f"3")
|
95 |
if cell is None:
|
@@ -126,6 +153,9 @@ async def add_exp(member_id):
|
|
126 |
#print(f"{member} Level up! {current_level-1} -> {current_level}!")
|
127 |
if current_role in member.roles:
|
128 |
await member.send(f"Level up! {current_level-1} -> {current_level}!")
|
|
|
|
|
|
|
129 |
|
130 |
except Exception as e:
|
131 |
print(f"add_exp Error: {e}")
|
|
|
54 |
|
55 |
|
56 |
|
57 |
+
|
58 |
+
|
59 |
+
async def search_csv(file_path, column_index, search_value):
|
60 |
+
with open(file_path, 'r', newline='') as csvfile:
|
61 |
+
reader = csv.reader(csvfile)
|
62 |
+
|
63 |
+
for row in reader:
|
64 |
+
if row and len(row) > column_index and row[column_index] == search_value:
|
65 |
+
print(row)
|
66 |
+
return row
|
67 |
+
|
68 |
+
return None
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
async def add_exp(member_id):
|
76 |
try:
|
77 |
+
#worksheet = gspread_bot.open("levelbot").sheet1
|
78 |
+
|
79 |
+
# Can only add exp to users who are discord users, whether or not they have a hub account linked
|
80 |
|
81 |
print(f"1")
|
82 |
guild = bot.get_guild(879548962464493619)
|
|
|
107 |
11: lvl11, 12: lvl12, 13: lvl13, 14: lvl14, 15: lvl15, 16: lvl16, 17: lvl17, 18: lvl18, 19: lvl19, 20: lvl20,
|
108 |
}
|
109 |
print(f"2")
|
110 |
+
if member.id == 811235357663297546:
|
111 |
# does a record already exist?
|
112 |
+
|
113 |
+
await search_csv(file_path, 0, member.id)
|
114 |
+
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
"""
|
120 |
length = len(worksheet.col_values(1))
|
121 |
print(f"3")
|
122 |
if cell is None:
|
|
|
153 |
#print(f"{member} Level up! {current_level-1} -> {current_level}!")
|
154 |
if current_role in member.roles:
|
155 |
await member.send(f"Level up! {current_level-1} -> {current_level}!")
|
156 |
+
|
157 |
+
"""
|
158 |
+
|
159 |
|
160 |
except Exception as e:
|
161 |
print(f"add_exp Error: {e}")
|