Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Synced repo using 'sync_with_huggingface' Github Action
Browse files
app.py
CHANGED
@@ -103,51 +103,52 @@ async def on_message(message):
|
|
103 |
lvl13 = guild.get_role(1171525021928263791)
|
104 |
lvl14 = guild.get_role(1171525062201966724)
|
105 |
lvl15 = guild.get_role(1171525098465918996)
|
106 |
-
|
|
|
107 |
if current_level == 2:
|
108 |
-
if
|
109 |
await message.author.add_roles(lvl2)
|
110 |
print(f"Gave {message.author} {lvl2}")
|
111 |
await message.author.remove_roles(lvl1)
|
112 |
print(f"Removed {lvl1} from {message.author}")
|
113 |
|
114 |
if current_level == 3:
|
115 |
-
if
|
116 |
await message.author.add_roles(lvl3)
|
117 |
print(f"Gave {message.author} {lvl3}")
|
118 |
await message.author.remove_roles(lvl2)
|
119 |
print(f"Removed {lvl2} from {message.author}")
|
120 |
|
121 |
if current_level == 4:
|
122 |
-
if
|
123 |
await message.author.add_roles(lvl4)
|
124 |
print(f"Gave {message.author} {lvl4}")
|
125 |
await message.author.remove_roles(lvl3)
|
126 |
print(f"Removed {lvl3} from {message.author}")
|
127 |
|
128 |
if current_level == 5:
|
129 |
-
if
|
130 |
await message.author.add_roles(lvl5)
|
131 |
print(f"Gave {message.author} {lvl5}")
|
132 |
await message.author.remove_roles(lvl4)
|
133 |
print(f"Removed {lvl4} from {message.author}")
|
134 |
|
135 |
if current_level == 6:
|
136 |
-
if
|
137 |
await message.author.add_roles(lvl6)
|
138 |
print(f"Gave {message.author} {lvl6}")
|
139 |
await message.author.remove_roles(lvl5)
|
140 |
print(f"Removed {lvl5} from {message.author}")
|
141 |
|
142 |
if current_level == 7:
|
143 |
-
if
|
144 |
await message.author.add_roles(lvl7)
|
145 |
print(f"Gave {message.author} {lvl7}")
|
146 |
await message.author.remove_roles(lvl6)
|
147 |
print(f"Removed {lvl6} from {message.author}")
|
148 |
|
149 |
if current_level == 8:
|
150 |
-
if
|
151 |
await message.author.add_roles(lvl8)
|
152 |
print(f"Gave {message.author} {lvl8}")
|
153 |
await message.author.remove_roles(lvl7)
|
@@ -200,7 +201,9 @@ async def on_message(message):
|
|
200 |
await message.author.add_roles(lvl15)
|
201 |
print(f"Gave {message.author} {lvl15}")
|
202 |
await message.author.remove_roles(lvl14)
|
203 |
-
print(f"Removed {lvl14} from {message.author}")
|
|
|
|
|
204 |
|
205 |
except Exception as e:
|
206 |
print(f"Error: {e}")
|
@@ -214,6 +217,46 @@ def calculate_level(xp):
|
|
214 |
return int(xp ** (1.0 / 3.0))
|
215 |
|
216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
217 |
@bot.command()
|
218 |
async def fixsheets(ctx):
|
219 |
if ctx.author.id == 811235357663297546:
|
|
|
103 |
lvl13 = guild.get_role(1171525021928263791)
|
104 |
lvl14 = guild.get_role(1171525062201966724)
|
105 |
lvl15 = guild.get_role(1171525098465918996)
|
106 |
+
|
107 |
+
"""
|
108 |
if current_level == 2:
|
109 |
+
if lvl2 not in message.author.roles:
|
110 |
await message.author.add_roles(lvl2)
|
111 |
print(f"Gave {message.author} {lvl2}")
|
112 |
await message.author.remove_roles(lvl1)
|
113 |
print(f"Removed {lvl1} from {message.author}")
|
114 |
|
115 |
if current_level == 3:
|
116 |
+
if lvl3 not in message.author.roles:
|
117 |
await message.author.add_roles(lvl3)
|
118 |
print(f"Gave {message.author} {lvl3}")
|
119 |
await message.author.remove_roles(lvl2)
|
120 |
print(f"Removed {lvl2} from {message.author}")
|
121 |
|
122 |
if current_level == 4:
|
123 |
+
if lvl4 not in message.author.roles:
|
124 |
await message.author.add_roles(lvl4)
|
125 |
print(f"Gave {message.author} {lvl4}")
|
126 |
await message.author.remove_roles(lvl3)
|
127 |
print(f"Removed {lvl3} from {message.author}")
|
128 |
|
129 |
if current_level == 5:
|
130 |
+
if lvl5 not in message.author.roles:
|
131 |
await message.author.add_roles(lvl5)
|
132 |
print(f"Gave {message.author} {lvl5}")
|
133 |
await message.author.remove_roles(lvl4)
|
134 |
print(f"Removed {lvl4} from {message.author}")
|
135 |
|
136 |
if current_level == 6:
|
137 |
+
if lvl6 not in message.author.roles:
|
138 |
await message.author.add_roles(lvl6)
|
139 |
print(f"Gave {message.author} {lvl6}")
|
140 |
await message.author.remove_roles(lvl5)
|
141 |
print(f"Removed {lvl5} from {message.author}")
|
142 |
|
143 |
if current_level == 7:
|
144 |
+
if lvl7 not in message.author.roles:
|
145 |
await message.author.add_roles(lvl7)
|
146 |
print(f"Gave {message.author} {lvl7}")
|
147 |
await message.author.remove_roles(lvl6)
|
148 |
print(f"Removed {lvl6} from {message.author}")
|
149 |
|
150 |
if current_level == 8:
|
151 |
+
if lvl8 not in message.author.roles:
|
152 |
await message.author.add_roles(lvl8)
|
153 |
print(f"Gave {message.author} {lvl8}")
|
154 |
await message.author.remove_roles(lvl7)
|
|
|
201 |
await message.author.add_roles(lvl15)
|
202 |
print(f"Gave {message.author} {lvl15}")
|
203 |
await message.author.remove_roles(lvl14)
|
204 |
+
print(f"Removed {lvl14} from {message.author}")
|
205 |
+
"""
|
206 |
+
|
207 |
|
208 |
except Exception as e:
|
209 |
print(f"Error: {e}")
|
|
|
217 |
return int(xp ** (1.0 / 3.0))
|
218 |
|
219 |
|
220 |
+
def calculate_xp(level):
|
221 |
+
return (int(level ** 3))
|
222 |
+
|
223 |
+
|
224 |
+
@bot.command()
|
225 |
+
async def restore_exp(ctx):
|
226 |
+
if ctx.author.id == 811235357663297546:
|
227 |
+
try:
|
228 |
+
guild = ctx.guild
|
229 |
+
lvl1 = guild.get_role(1171861537699397733)
|
230 |
+
lvl2 = guild.get_role(1171861595115245699)
|
231 |
+
lvl3 = guild.get_role(1171861626715115591)
|
232 |
+
lvl4 = guild.get_role(1171861657975259206)
|
233 |
+
lvl5 = guild.get_role(1171861686580412497)
|
234 |
+
lvl6 = guild.get_role(1171861900301172736)
|
235 |
+
lvl7 = guild.get_role(1171861936258941018)
|
236 |
+
lvl8 = guild.get_role(1171861968597024868)
|
237 |
+
lvl9 = guild.get_role(1171862009982242836)
|
238 |
+
lvl10 = guild.get_role(1164188093713223721)
|
239 |
+
lvl11 = guild.get_role(1171524944354607104)
|
240 |
+
lvl12 = guild.get_role(1171524990257082458)
|
241 |
+
lvl13 = guild.get_role(1171525021928263791)
|
242 |
+
lvl14 = guild.get_role(1171525062201966724)
|
243 |
+
lvl15 = guild.get_role(1171525098465918996)
|
244 |
+
|
245 |
+
# find all members with lvl13 role
|
246 |
+
members_with_role = [member.id for member in ctx.guild.members if lvl13 in member.roles]
|
247 |
+
# extract user_id + xp based on level
|
248 |
+
for member2 in members_with_role:
|
249 |
+
print(member2)
|
250 |
+
xp = calculate_xp(13)
|
251 |
+
level = calculate_level(xp+1)
|
252 |
+
print(xp)
|
253 |
+
print(level)
|
254 |
+
|
255 |
+
|
256 |
+
except Exception as e:
|
257 |
+
print(f"Error: {e}")
|
258 |
+
|
259 |
+
|
260 |
@bot.command()
|
261 |
async def fixsheets(ctx):
|
262 |
if ctx.author.id == 811235357663297546:
|