lunarflu HF staff commited on
Commit
80a1e02
1 Parent(s): e22c042

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -15,14 +15,19 @@ bot = commands.Bot(command_prefix='!', intents=intents)
15
 
16
 
17
  """"""
18
- XP_PER_MESSAGE = 1000000
 
 
19
  """"""
20
 
21
 
22
  @bot.event
23
  async def on_ready():
24
  print(f'Logged in as {bot.user.name}')
25
-
 
 
 
26
 
27
  try:
28
  with open('xp_data.json', 'r') as f:
@@ -45,6 +50,8 @@ async def on_message(message):
45
  xp_data.setdefault(author_id, 0) # default if it doesn't already exist
46
 
47
  xp_data[author_id] += XP_PER_MESSAGE
 
 
48
  save_xp_data()
49
 
50
  await bot.process_commands(message)
@@ -53,9 +60,7 @@ async def on_message(message):
53
  print(f"Error: {e}")
54
 
55
 
56
- # Calculate the level based on XP
57
- def calculate_level(xp):
58
- return int(xp ** (1.0 / 3.0))
59
 
60
 
61
  @bot.command()
 
15
 
16
 
17
  """"""
18
+ XP_PER_MESSAGE = 10 # 100k messages = 1M exp = lvl 100
19
+ def calculate_level(xp):
20
+ return int(xp ** (1.0 / 3.0))
21
  """"""
22
 
23
 
24
  @bot.event
25
  async def on_ready():
26
  print(f'Logged in as {bot.user.name}')
27
+ print(f"XP_PER_MESSAGE: {XP_PER_MESSAGE}")
28
+ print(f"xp_data: {xp_data}")
29
+ for author in xp_data:
30
+ print(f"XP people: {author}")
31
 
32
  try:
33
  with open('xp_data.json', 'r') as f:
 
50
  xp_data.setdefault(author_id, 0) # default if it doesn't already exist
51
 
52
  xp_data[author_id] += XP_PER_MESSAGE
53
+ print(f"xp_data: {xp_data}")
54
+
55
  save_xp_data()
56
 
57
  await bot.process_commands(message)
 
60
  print(f"Error: {e}")
61
 
62
 
63
+
 
 
64
 
65
 
66
  @bot.command()