SHARE
TWEET

Untitled

a guest Sep 21st, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. userLevelsLoad = open("userExp.pickle", "rb")
  2. levelReqLoad = open("userLevelReq.pickle", "rb")
  3. levelUpLoad = open("userLevel.pickle", "rb")
  4. userLevels = pickle.load(userLevelsLoad)
  5. levelReq = pickle.load(levelReqLoad)
  6. levelUp = pickle.load(levelUpLoad)
  7.  
  8. @client.event
  9. async def on_message(message):
  10.     channel = message.channel
  11.     userLevelsWrite = open("userExp.pickle", "wb")
  12.     levelReqWrite = open("userLevelReq.pickle", "wb")
  13.     levelUpWrite = open("userLevel.pickle", "wb")
  14.     await client.process_commands(message)
  15.     if message.author.id != 623901213980753950:
  16.         if message.author.name not in userLevels:
  17.             userLevels[message.author.name] = 0
  18.             levelReq[message.author.name] = 5
  19.             levelUp[message.author.name] = 0
  20.         else:
  21.             userLevels[message.author.name] = userLevels[message.author.name] + 1
  22.         if userLevels[message.author.name] >= levelReq[message.author.name]:
  23.             levelUp[message.author.name] = levelUp[message.author.name] + 1
  24.             levelReq[message.author.name] = levelReq[message.author.name] + (1/2)*levelReq[message.author.name]
  25.             userLevels[message.author.name] = 0
  26.             await channel.send(f'{message.author.name} leveled up to {levelUp[message.author.name]}')
  27.             pickle.dump(userLevels, userLevelsWrite)
  28.             pickle.dump(levelReq, levelReqWrite)
  29.             pickle.dump(levelUp, levelUpWrite)
  30.             userLevelsWrite.close()
  31.             levelReqWrite.close()
  32.             levelUpWrite.close()
  33.         else:
  34.             pickle.dump(userLevels, userLevelsWrite)
  35.             pickle.dump(levelReq, levelReqWrite)
  36.             pickle.dump(levelUp, levelUpWrite)
  37.             userLevelsWrite.close()
  38.             levelReqWrite.close()
  39.             levelUpWrite.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top