lunarflu HF staff commited on
Commit
b5e3666
1 Parent(s): ce27741

testing level roles - lunarflu

Browse files
Files changed (1) hide show
  1. app.py +54 -5
app.py CHANGED
@@ -64,12 +64,61 @@ async def on_message(message):
64
  print(f"xp_data: {xp_data}")
65
  save_xp_data()
66
 
67
- user = bot.get_user(811235357663297546)
 
68
  try:
69
- file = discord.File(data_file_path)
70
- await user.send(f"xp_data: {xp_data}", file=file)
71
- except discord.HTTPException:
72
- await user.send("Failed to send a DM.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  await bot.process_commands(message)
75
  except Exception as e:
 
64
  print(f"xp_data: {xp_data}")
65
  save_xp_data()
66
 
67
+
68
+
69
  try:
70
+ if message.author.id == 811235357663297546:
71
+ # get level
72
+ # if level 10 -> update with role id 1164188093713223721
73
+ # 11 1171524944354607104
74
+ # 12 1171524990257082458
75
+ # 13 1171525021928263791
76
+ # 14 1171525062201966724
77
+ # 15 1171525098465918996
78
+ guild = bot.get_guild(879548962464493619)
79
+ current_level = calculate_level(xp_data[author_id])
80
+ lvl10 = guild.get_role(1164188093713223721)
81
+ lvl11 = guild.get_role(1171524944354607104)
82
+ lvl12 = guild.get_role(1171524990257082458)
83
+ lvl13 = guild.get_role(1171525021928263791)
84
+ lvl14 = guild.get_role(1171525062201966724)
85
+ lvl15 = guild.get_role(1171525098465918996)
86
+
87
+
88
+ if current_level == 10:
89
+ if lvl10 not in message.author.roles:
90
+ await message.author.add_roles(lvl10)
91
+ #await message.author.remove_roles(role)
92
+
93
+ if current_level == 11:
94
+ if lvl11 not in message.author.roles:
95
+ await message.author.add_roles(lvl11)
96
+ await message.author.remove_roles(lvl10)
97
+
98
+ if current_level == 12:
99
+ if lvl12 not in message.author.roles:
100
+ await message.author.add_roles(lvl12)
101
+ await message.author.remove_roles(lvl11)
102
+
103
+ if current_level == 13:
104
+ if lvl13 not in message.author.roles:
105
+ await message.author.add_roles(lvl13)
106
+ await message.author.remove_roles(lvl12)
107
+
108
+ if current_level == 14:
109
+ if lvl14 not in message.author.roles:
110
+ await message.author.add_roles(lvl14)
111
+ await message.author.remove_roles(lvl13)
112
+
113
+ if current_level == 15:
114
+ if lvl15 not in message.author.roles:
115
+ await message.author.add_roles(lvl15)
116
+ await message.author.remove_roles(lvl14)
117
+
118
+ except Exception as e:
119
+ print(f"Error: {e}")
120
+
121
+
122
 
123
  await bot.process_commands(message)
124
  except Exception as e: