commands = { "!luckypls":[cmd_luckypls,"Member",None,[0],None,None], "!luckyplsperma":[cmd_luckypls,"BotOwner",None,[0],None,None], "test":[cmd_test,"Member",None,[0],"",None], "!yolocoin":[cmd_yolocoin,"Member",bot_channel,[0],None,None], "!animation":[cmd_animation,"Member",None,[0],None,None], "!scrolltext":[cmd_scrolltext,"Member",None,[-1],None,None], "!wall":[cmd_wall,"Moderators",None,[1,-2],"-",None], "!pyramid":[cmd_pyramid,"Moderators",None,[1,-2],"-",None], "!funkytext":[cmd_funkytext,"User",None,[-1],None,None], "!enablespam":[cmd_enablespam,"Moderators",None,[0],None,None], "!disablespam":[cmd_disablespam,"Moderators",None,[0],None,None], "!slots":[cmd_slots,"Member",bot_channel,[0],None,None], "!records":[cmd_slotsrecords,"Member",bot_channel,[1],None,None], "!points":[cmd_points,"Member",bot_channel,[1],None,None], "!leaderboards":[cmd_leaderboards,"Member",bot_channel,[0],None,None], "!anyone":[cmd_anyone,"Member",None,[1,2],None,"\\"], "!slots_dabomstewisadirtycheater":[cmd_slots,"Member",None,[0],None,None], "!usernoprofile":[cmd_usernoprofile,"BotOwner",None,[0],None,None], "!coin":[cmd_coin,"Member",bot_channel,[1],None,None], "!dc":[cmd_dc,"BotOwner",None,[0],None,None], "!exit":[cmd_dc,"BotOwner",None,[0],None,None], "!rigged":[cmd_rigged,"Member",bot_channel,[0],None,None], "!rngtest":[cmd_rngtest,"Member",bot_channel,[0],None,None], "!nolocoin":[cmd_yolocoin,"Member",bot_channel,[0],None,None], "!callrandom":[cmd_callrandom,"Member",None,[0],None,None], "!dsum":[cmd_dsum,"Member",None,[0],None,None], "!trolltext":[cmd_trolltext,"Member",None,[1,-2],None,None], "!enablerng":[cmd_enablerng,"Moderator",None,[0],None,None], "!disablerng":[cmd_disablerng,"Moderator",None,[0],None,None], "!foryoueekcast":[cmd_foryoueekcast,"BotOwner",None,[0],None,None], "!y151":[cmd_y151,"Member",None,[0],None,None], "!roles":[cmd_roles,"Member",None,[0],None,None], } @client.event def on_message(message): saved_message = message author = saved_message.author.name taguser = lambda: "<@%s> -> " % (saved_message.author.id) tagusernoarrow = lambda: "<@%s> " % (saved_message.author.id) checkForProfile = lambda: True if author in slots_data else False userNoProfile = lambda: client.send_message(saved_message.channel, taguser() + "You haven't played slots yet.") correctcase_usernames = {u.lower(): u for u in slots_data.keys()} if author == "luckytyphlosion" and len(luckymsgs) >= 10: temp_message = luckymsgs.pop(0) # commandmanager possible_cmd = saved_message.content new_cmd = False saved_possible_cmd = possible_cmd rigged_msg = saved_message.content.lower() print rigged_msg if (("rigged" in rigged_msg) or ("r i g g e d" in rigged_msg)) and saved_message.channel.name == bot_channel and author != "luckytyphlosion": client.send_message(saved_message.channel, "if it's rigged then why are you using it Kappa") for command in commands: possible_cmd = saved_possible_cmd if commands[command][4] == "": # get absolute value if command != possible_cmd: continue else: new_cmd = command break else: possible_cmd = (possible_cmd.split(commands[command][4],1))[0] command_ = (command.split(commands[command][4],1))[0] if commands[command][4]: possible_cmd += commands[command][4] command_ += commands[command][4] else: possible_cmd = possible_cmd.strip() + " " command_ = command.strip() + " " if command_.startswith(possible_cmd): new_cmd = command break # found a command if new_cmd: command = new_cmd # check perms can_execute_cmd = False for role_no in range(len(saved_message.author.roles)): if can_execute_cmd: break if author == "luckytyphlosion" or command == "!slots": # bot owner has access to all commands print(saved_message.author.roles[role_no].name + " | " + commands[command][1]) pass else: if commands[command][1] != saved_message.author.roles[role_no].name: print(saved_message.author.roles[role_no].name + " | " + commands[command][1]) continue # check channel perms if not commands[command][2]: can_execute_cmd = True break elif commands[command][2] != saved_message.channel.name: continue else: can_execute_cmd = True break if can_execute_cmd: query = None if commands[command][4] != "": query = (saved_possible_cmd.split(commands[command][4],1)).pop() # get query queries = get_queries(query,commands[command][3],commands[command][5]) # get what type of queries print "Command: %s" % command commands[command][0](queries,saved_message,author,taguser,checkForProfile,userNoProfile,correctcase_usernames) if author == "luckytyphlosion": luckymsgs.append(saved_message) # do this later so !luckypls doesn't overwrite itself