def check_check(): class message: content = "Deze tekst is Nederlands, maar bevat 4 cijfers; 1999 8 en 1 ! Jazeker, dat zijn er vier. Zoiets zou een Hooker zoals jij nooit opmerken." x = message() assert check.numbers(x) == [4,1999,8,1] assert check.numbers(x,3) == [4,1999,8] assert check.numbers(x,5) == False assert check.emojis(x) == False assert check.roles(x) == ['Hooker'] assert check.roles(x,1) == ['Hooker'] assert check.roles(x,2) == False
def process(message, isGameMaster=False, isAdmin=False, isPeasant=False): user_id = message.author.id message_channel = message.channel.id help_msg = "**List of commands:**\n" args = message.content.split(' ') # ============================================================= # # BOT COMMANDS # # ============================================================= if isPeasant == True: if check.is_command(message, ['success'], False, unip): token = args[1] choice = args[2] if box.token_status(token) != 1: return [Mailbox().respond("Wrong status, buddy.")] data = box.get_token_data(token) given_options = [int(data[3]), int(data[4]), int(data[5])] if int(choice) not in given_options: return [ Mailbox().respond("Invalid choice!", True).spam( "A webhook has given an invalid bug. This means one of the following two things;\n1. There's bug;\n2. Someone's trying to hack the bots through a webhook.\n\nBoth are not good." ) ] box.add_choice(token, choice) invt.take_item(int(box.get_token_data(token)[1]), int(choice[1:4]), int(choice[4:7])) return [ Mailbox().respond("Got it! *(I hope.)* Thanks.", True).thank(box.get_token_data(token)[11]) ] # ============================================================= # # ADMINISTRATOR # # ============================================================= if isAdmin == True: help_msg += "\n __Admin commands:__\n" if is_command(message, ['gift']): target = check.users(message) if not target: return [ Mailbox().respond( "No target provided! Please provide a target.", True) ] answer = Mailbox() for user_id in target: answer.gift(user_id) return [answer] if is_command(message, ['botanswer']): return [ Mailbox().respond( "Sounds pretty cool! How about you did something about it? *cough cough*" ) ] elif is_command(message, ['delete_category', 'start']): return [ Mailbox().respond(PERMISSION_MSG.format("Administrator"), True) ] # ============================================================= # # GAME MASTERS # # ============================================================= if isGameMaster == True: help_msg += "\n__Game Master commands:__\n" elif is_command(message, []): return [Mailbox().respond(PERMISSION_MSG.format("Game Master"), True)] # ============================================================= # # PARTICIPANTS # # ============================================================= if isParticipant(user_id): help_msg += "\n__Participant commands:__\n" user_undead = int(db_get(user_id, 'undead')) elif is_command(message, []): return [Mailbox().respond(PERMISSION_MSG.format("Participant"), True)] # ============================================================= # # EVERYONE # # ============================================================= help_msg += '\n\n' if is_command(message, ['lead']): number = check.numbers(message) if not number: return [Mailbox().respond(gen.gain_leaderboard(user_id), True)] return [ Mailbox().respond(gen.gain_leaderboard(user_id, max(number)), True) ] if is_command(message, ['lead'], True): msg = "**Usage:** Gain a list of the most active users on the server.\n\n`" + prefix + "leaderboard <number>`\n\n" msg += "**Example:** `" + prefix + "lead 10`.\nThe number is optional, and doesn't have to be given." help_msg += "`" + prefix + "leaderboard` - See an activity leaderboard.\n" if is_command(message, ['refer']): target = check.users(message, 1) if target[0] == user_id: return [ Mailbox().respond("Sorry, bud! You cannot refer yourself.") ] if not target: return [ Mailbox().respond( "No target provided! Please provide us with a target!") ] if gen.update_refer(user_id, target[0]) == True: return [ Mailbox().respond( "Alright! Expect you and <@{}> to have some extra luck getting a lootbox soon... ;)" .format(target[0])).gift(user_id).gift(target[0]) ] return [ Mailbox().respond("**ERROR:** You have already referred someone!") ] if is_command(message, ['rr', 'roulette', 'suicide']): return [roulette.surrender(True), roulette.take_shot(message)] if is_command(message, ['rr', 'roulette', 'suicide'], True): msg = "**Usage:** Play a game of Russian roulette!\n\n`" + prefix + "rr`\n\nTry it out! It's fun." return [Mailbox().respond(msg, True)] help_msg += "`" + prefix + "rr` - Play some Russian roulette!\n" if is_command(message, ['rs', 'roulscore', 'rscore']): target = check.users(message, 1) if not target: return [roulette.profile(message.author.id)] return [roulette.profile(target[0])] if is_command(message, ['rs', 'roulscore', 'rscore'], True): msg = "**Usage:** Check your current game progress.\n\n`" + prefix + "rs <user>`\n\n" msg += "**Example:** `" + prefix + "rs @Randium#6521`\nMentioning a user is optional." return [Mailbox().respond(msg, True)] help_msg += "`" + prefix + "rs` - See Russian Roulette score.\n" if roulette.is_playing(message.author): if is_command(message, ['surrender']): return [roulette.surrender(False, message.author)] if is_command(message, ['surrender'], True): msg = "**Usage:** Leave the game if you think you're gonna die.\n\n`" + prefix + "surrender`\n\nLeaving the game counts as a loss, but not as a death." help_msg += "`" + prefix + "surrender` - Leave the Russian roulette game.\n" # Profile commands profile_commands = process_profile(message=message, is_game_master=isGameMaster, is_admin=isAdmin, is_peasant=isPeasant) if profile_commands: return profile_commands help_msg += "\n`" + prefix + "age` - Set your age\n" help_msg += "`" + prefix + "bio` - Set your bio\n" help_msg += "`" + prefix + "gender` - Set your gender\n" help_msg += "`" + prefix + "profile` - View a player's profile\n" # -------------------------------------------------------------- # HELP # -------------------------------------------------------------- help_msg += "\n\n*If you have any more questions, feel free to ask any of the Game Masters!*" '''help''' if is_command(message, ['help']) and is_command(message, ['help'], True) == False: return [Mailbox().respond(help_msg, True)] if is_command(message, ['help'], True): answer = Mailbox().respond( "Hey there! `" + prefix + "help` will give you a list of commands that you can use.") answer.respond_add( "\nIf you have any questions, feel free to ask any of the Game Masters!" ) return [answer] if message.content.startswith(prefix): return [ roulette.surrender(True), Mailbox().respond( "Sorry bud, couldn't find what you were looking for.", True) ] return [roulette.surrender(True)]
def process(message, isGameMaster=False, isAdmin=False, isPeasant=False): user_id = message.author.id message_channel = message.channel.id help_msg = "**List of commands:**\n" args = message.content.split(' ') # ============================================================= # # BOT COMMANDS # # ============================================================= if isPeasant == True: pass # ============================================================= # # ADMINISTRATOR # # ============================================================= if isAdmin == True: help_msg += "\n __Admin commands:__\n" elif is_command(message, ['delete_category','start']): return [Mailbox().respond(PERMISSION_MSG.format("Administrator"), True)] # ============================================================= # # GAME MASTERS # # ============================================================= if isGameMaster == True: help_msg += "\n__Game Master commands:__\n" if is_command(message, ['userinv','userinventory']): target = check.users(message) if not target: return [Mailbox().respond("**INVALID SYNTAX:**\nNo target provided!",True)] answer = Mailbox().spam("**__<@{}>'S BALANCE__**".format(target[0])) for item in items.jget("items"): if has_item(target[0],item["code"]): answer.spam_add('\n{}x - **'.format(has_item(target[0],item["code"],False)) + item["name"] + '**') return [answer] if is_command(message, ['userinv','userinventory'], True): return todo() help_msg += "`" + prefix + "userinv` - View a user's inventory.\n" elif is_command(message, []): return [Mailbox().respond(PERMISSION_MSG.format("Game Master"), True)] # ============================================================= # # PARTICIPANTS # # ============================================================= if isParticipant(user_id): help_msg += "\n__Participant commands:__\n" user_undead = int(db_get(user_id,'undead')) elif is_command(message, []): return [Mailbox().respond(PERMISSION_MSG.format("Participant"), True)] # ============================================================= # # EVERYONE # # ============================================================= help_msg += '\n\n' '''buy''' if is_command(message, ['buy']): number = check.numbers(message) if not number: return [Mailbox().dm("No amount provided! Please provide me with a number!",True)] answer = [Mailbox().dm(shop.buy(user_id,number[0],message.author.name),user_id)] if is_command(message, ['buy'], True): msg = "**Usage:** Buy an item from the shop.\n\n`" + prefix + "buy <n>`\n\n" msg += "**Example:** `" + prefix + "buy 1`" return [Mailbox().respond(msg,True)] help_msg += "`" + prefix + "buy` - Buy item from the shop.\n" '''inventory''' if is_command(message, ['inv','inventory','bal','balance']): answer = Mailbox().dm("**__YOUR CURRENT BALANCE__**",user_id) for item in items.jget("items"): if has_item(user_id,item["code"]): answer.dm_add('\n{}x - **'.format(has_item(user_id,item["code"],False)) + item["name"] + '**') return [answer] if is_command(message, ['inv','inventory','bal','balance'], True): return todo() help_msg += "`" + prefix + "inventory` - View your inventory.\n" '''sell''' if is_command(message, ['sell']): number = check.numbers(message) if not number: return [Mailbox().dm("No amount provided! Please provide me with a number!",True)] answer = [Mailbox().dm(shop.sell(user_id,number[0],message.author.name),user_id)] if is_command(message, ['sell'], True): msg = "**Usage:** Sell an item from the shop.\n\n`" + prefix + "sell <n>`\n\n" msg += "**Example:** `" + prefix + "sell 1`" return [Mailbox().respond(msg,True)] help_msg += "`" + prefix + "sell` - Buy item from the shop.\n" '''shop''' if is_command(message, ['shop']): answer = Mailbox() for msg in shop.get_market_message(): answer.respond(msg,True) return answer if is_command(message, ['shop']): msg = "**Usage:** View the Devil Bot's shop.\n\n`" + prefix + "shop`" return [Mailbox().respond(msg,True)] help_msg += "`" + prefix + "shop` - View the Devil's shop." help_msg += "\n\n__Item specific commands:__" '''attack''' if is_command(message, ['attack', 'dagger', 'kill']): pass # TODO '''disguise''' if is_command(message,['disguise','dis']): return [use_item(103,message)] if is_command(message,['disguise','dis'],True): msg = "**Usage:** Disguise a participant.\n\n`" + prefix + "disguise @Randium#6521 Innocent`\n\n" msg += "This command can only be used by participants. You can disguise yourself." return [Mailbox().respond(msg,True)] help_msg += "`" + prefix + "disguise` - Disguise a participant.\n" '''hide''' if is_command(message,['hide']): return [use_item(100,message)] if is_command(message,['disguise','dis'],True): msg = "**Usage:** Disguise a participant.\n\n`" + prefix + "disguise @Randium#6521 Innocent`\n\n" msg += "This command can only be used by participants. You can disguise yourself." return [Mailbox().respond(msg,True)] help_msg += "`" + prefix + "hide` - Become invisible for the night.\n" # -------------------------------------------------------------- # HELP # -------------------------------------------------------------- help_msg += "\n\n*If you have any more questions, feel free to ask any of the Game Masters!*" '''help''' if is_command(message,['help']) and is_command(message,['help'],True) == False: return [Mailbox().respond(help_msg,True)] if is_command(message,['help'],True): answer = Mailbox().respond("Hey there! `" + prefix + "help` will give you a list of commands that you can use.") answer.respond_add("\nIf you have any questions, feel free to ask any of the Game Masters!") return [answer] if message.content.startswith(prefix): return [Mailbox().respond("Sorry bud, couldn't find what you were looking for.", True)] return []
def process(message, isGameMaster=False, isAdmin=False, isPeasant=False): user_id = message.author.id message_channel = message.channel.id help_msg = "**List of commands:**\n" args = message.content.split(' ') # ============================================================= # # BOT COMMANDS # # ============================================================= if isPeasant == True: if is_command(message, ['success']): token = args[1] choice = args[2] if box.token_status(token) != 2: return [] data = box.get_token_data(token) given_options = [int(data[3]), int(data[4]), int(data[5])] if choice not in given_options: return [ Mailbox().respond("Invalid choice!", True).spam( "A webhook has given an invalid bug. This means one of the following two things;\n1. There's bug;\n2. Someone's trying to hack the bots through a webhook.\n\nBoth are not good." ) ] box.add_choice(token, choice) return [ Mailbox().respond( "Got it! Thanks.\n*(Well, not really, this still needs to be done, but...)*" ) ] # ============================================================= # # ADMINISTRATOR # # ============================================================= if isAdmin == True: help_msg += "\n __Admin commands:__\n" elif is_command(message, ['delete_category', 'start']): return [ Mailbox().respond(PERMISSION_MSG.format("Administrator"), True) ] # ============================================================= # # GAME MASTERS # # ============================================================= if isGameMaster == True: help_msg += "\n__Game Master commands:__\n" elif is_command(message, []): return [Mailbox().respond(PERMISSION_MSG.format("Game Master"), True)] # ============================================================= # # PARTICIPANTS # # ============================================================= if isParticipant(user_id): help_msg += "\n__Participant commands:__\n" user_undead = int(db_get(user_id, 'undead')) elif is_command(message, []): return [Mailbox().respond(PERMISSION_MSG.format("Participant"), True)] # ============================================================= # # EVERYONE # # ============================================================= help_msg += '\n\n' if is_command(message, ['lead']): number = check.numbers(message) if not number: return [Mailbox().respond(gen.gain_leaderboard(user_id))] return [ Mailbox().respond(gen.gain_leaderboard(user_id, max(number)), True) ] if is_command(message, ['lead'], True): msg = "**Usage:** Gain a list of the most active users on the server.\n\n`" + prefix + "leaderboard <number>`\n\n" msg += "**Example:** `" + prefix + "lead 10`.\nThe number is optional, and doesn't have to be given." help_msg += "`" + prefix + "lead` - See an activity leaderboard.\n" # Profile commands profile_commands = process_profile(message=message, is_game_master=isGameMaster, is_admin=isAdmin, is_peasant=isPeasant) if profile_commands: return profile_commands help_msg += "`" + prefix + "age` - Set your age\n" help_msg += "`" + prefix + "bio` - Set your bio\n" help_msg += "`" + prefix + "gender` - Set your gender\n" help_msg += "`" + prefix + "profile` - View a player's profile\n" # -------------------------------------------------------------- # HELP # -------------------------------------------------------------- help_msg += "\n\n*If you have any more questions, feel free to ask any of the Game Masters!*" '''help''' if is_command(message, ['help']) and is_command(message, ['help'], True) == False: return [Mailbox().respond(help_msg, True)] if is_command(message, ['help'], True): answer = Mailbox().respond( "Hey there! `" + prefix + "help` will give you a list of commands that you can use.") answer.respond_add( "\nIf you have any questions, feel free to ask any of the Game Masters!" ) return [answer] if message.content.startswith(prefix): return [ Mailbox().respond( "Sorry bud, couldn't find what you were looking for.", True) ] return []