def display_tickets(user): raffle_dict = bot_xp.load_obj(RAFFLE_FILE) if not raffle_dict: message('Currently no users have raffle tickets') return message('%s Has %s Raffle Tickets' % (user, raffle_dict[user])) return
def buy_ticket(user): xp_dict = bot_xp.load_obj(XP_FILE) raffle_dict = bot_xp.load_obj(RAFFLE_FILE) try: if not raffle_dict: raffle_dict = {} if xp_dict[user] >= int(RAFFLE_COST): xp_dict[user] = xp_dict[user] - int(RAFFLE_COST) if user in raffle_dict.keys(): raffle_dict[user] = raffle_dict[user] + 1 else: raffle_dict[user] = 1 message('Thats %sxp, enjoy your raffle ticket![Current Count: %s]' % (RAFFLE_COST, raffle_dict[user])) bot_xp.save_obj(xp_dict, XP_FILE) bot_xp.save_obj(raffle_dict, RAFFLE_FILE) else: message('Raffle Tickets cost %sxp, you only have %s' % (RAFFLE_COST, xp_dict[user])) except Exception: pass return
def command_get_user_xp(user): data_dict = bot_xp.load_obj(XP_FILE) if not data_dict: message('Currently no XP File...') return try: users_xp = data_dict[user] except KeyError: users_xp = 0 pass message('%s your XP is: %s' % (user, users_xp)) return
def buy_ticket(user): xp_dict = bot_xp.load_obj(XP_FILE) raffle_dict = bot_xp.load_obj(RAFFLE_FILE) try: if not raffle_dict: raffle_dict = {} if xp_dict[user] >= RAF_COST: xp_dict[user] = xp_dict[user] - RAF_COST if user in raffle_dict.keys(): raffle_dict[user] = raffle_dict[user] + 1 else: raffle_dict[user] = 1 message( 'Thats %sxp, enjoy your raffle ticket![Current Count: %s]' % (RAF_COST, raffle_dict[user])) bot_xp.save_obj(xp_dict, XP_FILE) bot_xp.save_obj(raffle_dict, RAFFLE_FILE) else: message('Raffle Tickets cost %sxp, you only have %s' % (RAF_COST, xp_dict[user])) except Exception: pass return
def enter_the_raffle(user): global CURRENT_RAFFLE raffle_dict = bot_xp.load_obj(RAFFLE_FILE) if not raffle_dict: raffle_dict = {} if user in raffle_dict.keys(): if raffle_dict[user] >= 1: CURRENT_RAFFLE.append(user) raffle_dict[user] = raffle_dict[user] - 1 bot_xp.save_obj(raffle_dict, RAFFLE_FILE) else: message('%s has no raffle tickets' % user) return else: message('%s has no raffle tickets' % user) return return
def enter_the_raffle(user): global CURRENT_RAFFLE raffle_dict = bot_xp.load_obj(RAFFLE_FILE) if not raffle_dict: raffle_dict = {} if user in raffle_dict.keys(): if raffle_dict[user] >= 1: CURRENT_RAFFLE.append(user) raffle_dict[user] = raffle_dict[user] - 1 message('%s has joined the Raffle!' % user) bot_xp.save_obj(raffle_dict, RAFFLE_FILE) else: message('%s has no raffle tickets' % user) return else: message('%s has no raffle tickets' % user) return return