def pight():
    """This function takes care of all properties that need to happen in the first wave of the end of the day.
    The function returns a Mailbox."""

    if dy.get_stage() == "Night":
        return [
            Mailbox().respond(
                "Whaddaya mean, `{}pight`? It already **is** night, bud.".
                format(config.universal_prefix))
        ]

    answer = Mailbox(True)
    for user_id in db.player_list():
        user_role = db_get(user_id, 'role')

        # Remove potential day uses
        for i in range(len(roles.day_users)):
            if user_role in roles.day_users[i]:
                if i > 0:
                    db_set(user_id, 'uses', 0)
                break

        # Give the user their votes back
        db_set(user_id, 'votes', 1)
        if user_role == "Immortal":
            db_set(user_id, 'votes', 3)
        if user_role == "Idiot ":
            db_set(user_id, 'votes', 0)

    return [answer]
def aura(user_id,victim_id):
    """This function allows the aura teller to inspect if a given user is among the wolf pack or not.
    The function assumes the player is an aura teller and has the correct role, so make sure to have filtered this out already.
    The function returns a Mailbox.

    user_id -> the player who casts the spell
    victim_id -> the player who is being searched"""

    uses = int(db_get(user_id,'uses'))
    if uses < 1:
        return Mailbox().respond("I am sorry! You currently don't have the ability to see this player!",True)

    victim_role = db_get(victim_id,"role")
    victim_frozen = int(db_get(victim_id,'frozen'))
    victim_abducted = int(db_get(victim_id,'abducted'))

    user_channel = int(db_get(user_id,"channel"))
    user_undead = int(db_get(user_id,'undead'))

    if user_undead == 1:
        return Mailbox().dm("You are undead! This means that you can no longer inspect players. I\'m sorry!",user_id)
    if victim_abducted == 1:
        return Mailbox().msg("You tried to inspect <@{}>... but their aura seemed empty! Almost as if they weren't there!\nYou decided to inspect someone else.",user_channel,True)
    if victim_frozen == 1:
        return Mailbox().msg("You have tried to inspect <@{}>, but it turns out you couldn\'t see their aura all the way through the ice! Luckily, you had the opportunity to try again.",user_channel,True)

    db_set(user_id,'uses',uses - 1)

    if victim_role in wolf_pack:
        answer = Mailbox().msg("🐺 - <@{}> has a **RED AURA** - they are taking part in the wolf pack!".format(victim_id),user_channel)
        return answer.log("The **Aura Teller** <@{}> has inspected the **{}** <@{}>, and found out they were part of the wolf pack!".format(user_id,victim_role,victim_id))

    answer = Mailbox().msg("🐶 - <@{}> has a **GREEN AURA** - they are not taking part in the wolf pack.".format(victim_id),user_channel)
    return answer.log("The **Aura Teller** <@{}> has inspected <@{}>, who, being the **{}**, wasn't part of the wolf pack.".format(user_id,victim_id,victim_role))
Exemple #3
0
def view_profile(message: Message):
    users = check.users(message,
                        amount=1,
                        delete_duplicates=True,
                        must_be_participant=False)
    user: User = message.author
    if users:
        if isParticipant(message.author.id) and not isParticipant(users[0]):
            return [
                Mailbox().respond(
                    "I am sorry! To prevent any accidental spoilers, you cannot view the profile of dead players.",
                    True)
            ]
        user = message.channel.guild.get_member(users[0])
    model = ProfileModel.get_or_insert(user)
    em = Embed(
        title=f'Profile of {user.display_name}',
        description=model.bio,
    )
    em.set_author(name=user.display_name, icon_url=user.avatar_url)
    em.add_field(name="Age", value=str(model.display_age))
    em.add_field(name="Gender", value=model.gender)
    em.add_field(name="Credits", value=get_credits(user.id))
    em.add_field(name="Referral score", value=gen_get(user.id, 'refer_score'))
    if get_user(user.id)[4] > 0:
        em.add_field(name="Roulette Highscore", value=get_user(user.id)[4])
    return [
        Mailbox().embed(em, destination=message.channel.id, temporary=True)
    ]
Exemple #4
0
    def power_inspect(self, numbers, roles, users):
        other = users[0]
        self.uses += -1

        if other.role == other.fakerole and other.undead:
            return Mailbox().respond(
                "{} - <@{}> has the role of the `Undead`!".format(
                    other.emoji, other.id))
        return Mailbox().respond("{} - <@{}> has the role of the `{}`!".format(
            other.emoji, other.id, other.fakerole))
def ignite(user_id):
    """This function ignites all powdered players that aren't pyromancer.
    The function assumes the player is a participant and has the correct role, so make sure to have filtered this out already.
    The function returns a Mailbox.

    user_id -> the player who ignites all powdered players"""

    uses = int(db_get(user_id,'uses'))
    if uses < 1:
        return Mailbox().respond("I am sorry! You currently cannot ignite anyone!",True)
    db_set(user_id,'uses',uses - 1)

    user_role = db_get(user_id,'role')
    user_channel = db_get(user_id,'channel')
    user_undead = int(db_get(user_id,'undead'))

    if user_undead == 1:
        answer = Mailbox().log("<@{}>, an undead **{}**, has pretended to ignite all powdered players.".format(user_id,user_role))
        answer.dm("Hey, you are undead, so your power won\'t work. But at least this won\'t blow your cover!",user_id)
        return answer.msg("Okay! All powdered players will die tomorrow.",user_channel)

    # Ignite all living players.
    for user in db.player_list(True,True):
        if db.isParticipant(user) and db_get(user,'role') != 'Pyromancer':
            db.add_kill(int(user),'Pyromancer',user_id)

    answer = Mailbox().log("The **{}** <@{}> has ignited all powdered players!".format(user_role,user_id))
    return answer.msg("Okay! All powdered players will die tomorrow.",user_channel)
Exemple #6
0
def set_gender(message: Message) -> List[Mailbox]:
    _, gender = re.split(r'\s+', message.content, 1)
    if len(gender) >= 255:
        return [
            Mailbox().respond(
                "Invalid gender. If you really need more than 255 chars to express your gender, contact a GM",
                temporary=True)
        ]
    profile = ProfileModel.get_or_insert(message.author)
    profile.gender = gender
    profile.save()
    return [Mailbox().respond("Updated your profile!")]
def nightly_kill(user_id,victim_id):
    """This function adds a kill to the kill queue based on the user's role.  
    This function is applicable for roles like the assassin, the lone wolf, the priest, the thing and the white werewolf.  
    NOTICE: This function is meant for people who kill solo! Teams should receive a poll.
    Evaluating whether the kill should actually be applied isn't needed, as this is evaluated at the start of the day.
    The function assumes the player is a participant and has the correct role, so make sure to have filtered this out already.  
    The function returns a Mailbox.

    user_id -> the player who will initiate the attack
    victim_id -> the player who shall be \"attacked\""""

    uses = int(db_get(user_id,'uses'))
    if uses < 1:
        return Mailbox().respond("I am sorry! You currently don't have this ability available!",True)

    if user_id == victim_id:
        return Mailbox().respond("I am sorry, but you cannot attempt suicide!\nNot because it's not an option, no, just because we want to see you SUFFER!",True)

    # TODO: Prevent targeting of abducted/frozen players.
    if int(db_get(user_id,'undead')) == 1 or db_get(user_id,'role') == 'Undead':
        return Mailbox().respond("I am sorry! Now that you are Undead, you can no longer use this power.",True)
    if int(db_get(victim_id,'abducted')) == 1:
        return Mailbox().respond("You attempted to attack <@{}>... but they don't seem to be around in town! That is strange.".format(victim_id),True)
    if int(db_get(user_id,'frozen')) == 1:
        return Mailbox().respond("You wanted to pay a visit to <@{}>... but it seems they were frozen! Try again, please.".format(victim_id),True)

    user_role = db_get(user_id,'role')
    user_channel = int(db_get(user_id,'channel'))

    db_set(user_id,'uses',uses - 1)
    db.add_kill(victim_id,user_role,user_id)

    answer = Mailbox().msg(ctory.kill_acceptance(victim_id),user_channel)
    return answer.log("The **{}** <@{}> has chosen to pay <@{}> a visit tonight.".format(user_role,user_id,victim_id))
Exemple #8
0
def disguise(user_id,victim_id,role):
    """This fuction is taking the tanner's action of disguising people.
    The function assumes the player is a participant and has the correct role, so make sure to have filtered this out already.  
    The function returns a Mailbox.  

    user_id -> the player who casts the spell
    victim_id -> the player upon whom the spell is cast
    role -> the role the player should be disguised as"""

    uses = int(db_get(user_id,'uses'))
    if uses < 1:
        return Mailbox().respond("I am sorry! You currently don't have the ability to disguise anyone!",True)
    db_set(user_id,'uses',uses - 1)

    user_channel = int(db_get(user_id,'channel'))
    user_role = db_get(user_id,'role')
    victim_role = db_get(user_id,'role')

    db_set(victim_id,'fakerole',role)
    answer = Mailbox().msg("You have successfully disguised <@{}> as the **{}**!".format(victim_id,role),user_channel)
    
    if uses - 1 > 0:
        answer.msg("You can disguise **{}** more players!".format(uses-1),user_channel,True)
    else:
        answer.msg("That\'s it for today! You can\'t disguise any more players.",user_channel,True)
    
    return answer.log("**{}** <@{}> has disguised <@{}>, the **{}**, as the **{}**!".format(user_role,user_id,victim_id,victim_role,role))
Exemple #9
0
    def attack(self, murderer, answer=Mailbox(), recursive='\n'):
        # TODO: Get the victim's standoff list, and check if it has an executioner standoff.
        replacements = [
            standoff for standoff in db.get_standoff(user_id)
            if standoff[2] == 'Executioner'
        ]

        if replacements == []:
            answer.log_add(recursive + success + skull +
                           '<@{}> was killed by an angry mob.'.format(user_id))
            answer = instant_death(user_id, role, answer, recursive + next)

        else:
            answer.log_add(recursive + success +
                           '<@{}> escaped death as the Executioner.')

            if user_role == 'Executioner':
                db_set(user_id, 'role', 'Innocent')

            for standoff in replacements:
                db.delete_standoff(standoff[0])
                answer = instant_death(standoff[1], standoff[2], answer,
                                       recursive + next)

        return answer
Exemple #10
0
    def attack(self, murderer, answer=Mailbox(), recursive='\n'):
        if self.undead:
            answer.dm(
                "Your idol, the fortune teller <@{}>, has deceased. ".format(
                    murderer), self.id)
            answer.dm_add("They were a great inspiration to you... ")
            answer.dm_add(
                "back when you were alive, at least. Now, your undead heart is as cold as it has ever been, "
            )
            answer.dm_add("and nothing will happen to you.\n")
            answer.dm_add(
                "**The rules do not change. You will remain Undead.**")
            answer.log_add(
                recursive + success +
                '<@{}> failed to become a Fortune Teller.'.format(self.id))
            return answer

        answer.dm(
            "Your idol, the fortune teller <@{}>, has deceased. ".format(
                murderer), self.id)
        answer.dm_add("They were a great inspiration to you, and that's why ")
        answer.dm_add("you've decided to get in their footsteps!\n")
        answer.dm_add("**You have turned into a Fortune Teller. Find and ")
        answer.dm_add(
            "eliminate all werewolves, solo players and other enemies!**")
        answer.log_add(recursive + success +
                       '<@{}> became a Fortune Teller.'.format(self.id))
        return answer
Exemple #11
0
def instant_death(user_id,
                  role,
                  deathType,
                  answer=Mailbox().log(''),
                  recursive=''):
    """Eliminate the given user."""

    # If the user was reporter or mayor, get rid of that.
    if dy.get_mayor() == user_id:
        dy.kill_mayor()
        answer.remove_proms(user_id)
    if dy.get_reporter() == user_id:
        dy.kill_reporter()
        answer.remove_proms(user_id)

    for channel_id in db.get_secret_channels("Graveyard"):
        answer.edit_cc(channel_id, user_id, 1)

    # Change all channel settings
    for channel_id in db.channel_change_all(user_id, 1, 4):
        answer.edit_cc(channel_id, user_id, 4)
    for channel_id in db.channel_change_all(user_id, 2, 4):
        answer.edit_cc(channel_id, user_id, 4)
    for channel_id in db.channel_change_all(user_id, 5, 4):
        answer.edit_cc(channel_id, user_id, 4)

    # Change abducted settings
    for channel_id in db.channel_change_all(user_id, 3, 7):
        answer.edit_cc(channel_id, user_id, 7)
    for channel_id in db.channel_change_all(user_id, 6, 7):
        answer.edit_cc(channel_id, user_id, 7)

    for channel_id in db.get_secret_channels("Market"):
        answer.edit_cc(channel_id, user_id, 4)

    for channel_id in db.get_secret_channels("Reporter"):
        if int(db_get(user_id, 'undead')) == 1:
            answer.msg(
                "{} - <@{}> had the role of the `Undead`!".format(
                    db_get(user_id, 'emoji'), user_id), channel_id)
        else:
            answer.msg(
                "{} - <@{}> had the role of the `{}`!".format(
                    db_get(user_id, 'emoji'), user_id,
                    db_get(user_id, 'role')), channel_id)

    # Kill that user already!
    db_set(user_id, 'role', 'Dead')
    db_set(user_id, 'fakerole', 'Dead')

    answer.spam(unip + 'kill <@{}>'.format(user_id))

    if int(db_get(user_id, 'abducted')) != 1 and role not in ["Barber"]:
        db.insert_deadie(user_id, deathType)

    # Kill all standoffs
    for taker in db.get_standoff(user_id):
        answer = attack(taker[1], taker[2], taker[3], answer, recursive)

    return answer
def set_gender(message: Message) -> List[Mailbox]:
    _, gender = re.split(r'\s+', message.content, 1)
    if len(gender) >= 255:
        return [Mailbox().respond(
            "Invalid gender. If you really need more than 255 chars to express your gender, contact a GM",
            temporary=True)]
    profile = ProfileModel.get_or_insert(message.author)
    if gender.lower().startswith('m'):
        profile.gender = 'Male'
    elif gender.lower().startswith('f'):
        profile.gender = 'Female'
    elif gender.lower().startswith('r'):
        profile.gender = 'Randium'
    else:
        profile.gender = 'Other'
    profile.save()
    return [Mailbox().respond("Updated your profile!")]
Exemple #13
0
def freeze(user_id, victim_id=None, role=None):
    """This function allows the ice king to add a user to their list of potential freezers, or possibly remove one.
    The function assumes both players are participants, so make sure to have filtered this out already.
    The function returns a Mailbox.

    Keyword arguments:
    user_id -> the ice king's id
    victim_id -> the guessed one's id
    role -> the role they were guessed as. (None if removing the guessed one)"""

    user_channel = int(db_get(user_id, 'channel'))

    if victim_id == None:
        if db.get_freezers(user_id) == []:
            return Mailbox().respond(
                "**INVALID SYNTAX:**\nPlease make sure to mention a user.\n\n**Tip:** You can also mention their emoji!",
                True)

        msg = "__Your current guesses:__\n"
        for freezer in db.get_freezers(user_id):
            msg += "{}. <@{}> - {}\n".format(db_get(freezer[0], 'emoji'),
                                             freezer[0], freezer[1])
        return Mailbox().msg(msg, user_channel, True)

    victim_frozen = int(db_get(victim_id, 'frozen'))
    victim_abducted = int(db_get(victim_id, 'abducted'))

    # tODO: Prevent ice kings from guessing another ice kings (or themselves).
    if victim_abducted == 1:
        return Mailbox().msg(
            "You tried to freeze <@{}>... but you couldn't find them! That is strange."
            .format(victim_id), user_channel, True)
    if victim_frozen == 1:
        return Mailbox().msg(
            "You don't need to freeze <@{}>, you silly! They're already frozen!"
            .format(victim_id), user_channel, True)

    if role == None:
        if db.delete_freezer(user_id, victim_id) == True:
            return Mailbox().msg(
                "You have removed <@{}> from your freeze list.".format(
                    victim_id), user_channel, True)
        return Mailbox().msg(
            "**INVALID SYNTAX:** No role provided!\n\nMake sure to provide with a role to add a user to your freeze list.",
            user_channel, True)

    old_role = db.add_freezer(user_id, victim_id, role)

    if old_role == None:
        return Mailbox().msg(
            "You have added <@{}> to your list as the **{}**.".format(
                victim_id, role), user_channel, True)
    return Mailbox().msg(
        "You have switched <@{}> from the **{}** to the **{}**.".format(
            victim_id, old_role, role), user_channel, True)
Exemple #14
0
def set_bio(message: Message):
    _, bio = re.split(r'\s+', message.content, 1)
    profile = ProfileModel.get_or_insert(message.author)
    new_bio = ""
    for char in bio:
        if char not in ["\\", "/"]:
            new_bio += char
    profile.bio = new_bio
    profile.save()
    return [Mailbox().respond("Updated your profile!")]
Exemple #15
0
def process_profile(message: Message, is_game_master, is_admin,
                    is_peasant) -> Optional[List[Mailbox]]:
    if is_command(message, ['age', 'setage'], help=True):
        return [
            Mailbox().respond(
                "Use this command to set your age in your profile",
                temporary=True)
        ]
    if is_command(message, ['age', 'setage']):
        return set_age(message)

    if is_command(message, ['gender', 'setgender'], help=True):
        return [
            Mailbox().respond(
                "Use this command to set your gender in your profile. We left it free to fill "
                "anything in, but if this gets abused ya getting whipped!",
                temporary=True)
        ]
    if is_command(message, ['gender', 'setgender']):
        return set_gender(message)

    if is_command(message, ['setbio', 'bio'], help=True):
        return [
            Mailbox().respond(
                "Use this command to set your biography in your profile.",
                temporary=True)
        ]
    if is_command(message, ['setbio', 'bio']):
        return set_bio(message)

    if is_command(message, ['profile', 'view_profile'], help=True):
        return [
            Mailbox().respond(
                "Use this command to view your or other peoples profile.",
                temporary=True)
        ]
    if is_command(message, ['profile', 'view_profile']):
        return view_profile(message)
    return None
Exemple #16
0
def nightly_kill(user_id,victim_id):
    """This function adds a kill to the kill queue based on the user's role.
    This function is applicable for roles like the assassin, the lone wolf, the priest, the thing and the white werewolf.
    Evaluating whether the kill should actually be applied isn't needed, as this is evaluated at the start of the day.  
    The function assumes the player is a participant and has the correct role, so make sure to have filtered this out already.  
    The function returns a Mailbox.  
    
    user_id -> the player who will initiate the attack
    victim_id -> the player who shall be \"attacked\""""

    uses = int(db_get(user_id,'uses'))
    if uses < 1:
        return Mailbox().respond("I am sorry! You currently don't have this ability available!",True)
    db_set(user_id,'uses',uses - 1)

    user_role = db_get(user_id,'role')
    user_channel = int(db_get(user_id,'channel'))

    # Add kill to the kill queue
    db.add_kill(victim_id,user_role,user_id)

    answer = Mailbox().msg(ctory.kill_acceptance(victim_id),user_channel)
    return answer.log("The **{}** <@{}> has chosen to pay a visit to <@{}> tonight.".format(user_role,user_id,victim_id))
Exemple #17
0
 def power(self, me, victim):
     if me.undead == True:
         return Mailbox().respond(
             "I'm sorry, buddy! Now that you've become undead, you have lost your power to kill!",
             me.channel)
     if me.uses > 0:
         for player in Game_Control().participants:
             if victim.id == player.id and player.role.name not in [
                     "Spectator", "Dead"
             ]:
                 me.uses += -1
                 Game_Control().add_kill(
                     victim.id, "Assassin",
                     Mailbox().respond(
                         "The **Assassin** <@{}> has attacked".format(
                             me.id), me.channel))
                 return Mailbox().respond(
                     "Target chosen! Tonight, you shall attack <@{}>!".
                     format(victim.id), me.channel)
         return Mailbox().respond(
             "I am terribly sorry! For some reason, I couldn't find your target.",
             me.channel)
     return Mailbox().respond(
         "I'm sorry, bud! You can't use your power. Not now...", me.channel)
Exemple #18
0
def profile(user_id):
    global winners
    global deadies

    answer = '**__Profile of <@{}>:__**\n'.format(user_id)
    user_class = None

    for good_guy in winners:
        if user_id == good_guy.user.id:
            user_class = good_guy
    for bad_boy in deadies:
        if user_id == bad_boy.user.id:
            user_class = bad_boy

    if user_class == None:
        answer += "**Score: 0 points.**\n*Play a game to get some points!*"
    else:
        answer += "**Score: {} point".format(len(user_class))
        if len(user_class) != 1:
            answer += "s"
        answer += ".**\n" + str(user_class)

    return Mailbox().respond(answer, True)
def set_age(message: Message) -> List[Mailbox]:
    _, *params = message.content.split(' ')
    if len(params) == 0:
        return [Mailbox().respond("Invalid arguments. Please check the help.", temporary=True)]
    new_age, *_ = params  # because im too cool for params[0] ~ roman
    if not new_age.isdigit():
        return [Mailbox().respond('Sorry bro, only positive whole numbers', temporary=True)]
    new_age = int(new_age)
    if new_age > 2 ** 31 - 1:
        if new_age > 15556000000:
            return [Mailbox().respond("You sure, bud? That\'s older than the universe. Time wasn\'t a thing back then. ...there is no such thing as a **BEFORE** the Big Bang.",True)]
        if new_age > 4560000000:
            return [Mailbox().respond("Yeah, sure thing! The creation of our planet must\'ve been enjoyable to watch.",True)]
        return [Mailbox().respond(f"Bruh, I know yo momma's as heavy as Mother Earth, "
                                  f"but that doesn't make you as old as her.", temporary=True)]
    profile = ProfileModel.get_or_insert(message.author)
    profile.age = new_age
    profile.save()
    return [Mailbox().respond("Updated your profile!")]
Exemple #20
0
def attack(user_id, role, murderer, answer=Mailbox().log(''), recursive='\n'):
    """This functions attacks the given player with the given role.  
    The effects are immediate, but they can be used in all scenarios, as only\
    standoffs are executed during this attack."""

    if role == 'Inactive':
        answer.log_add(recursive + success + skull +
                       "<@{}> was killed due to inactivity.".format(user_id))
        return instant_death(user_id, role, 'Inactive', answer,
                             recursive + next)

    # Prevent Pyromancer from causing way too long lines
    # No, I didn't add this during debugging.
    # Yes, that means I planned to design it this terribly.
    if role == 'Pyromancer' and int(db_get(user_id, 'powdered')) != 1:
        return answer

    user_role = db_get(user_id, 'role')
    answer.log_add(recursive + failure)

    try:
        demonized = False
        if int(db_get(user_id, 'demonized')) == 1:
            demonized = True

        undead = False
        if int(db_get(user_id, 'undead')) == 1 or user_role == 'Undead':
            undead = True
            demonized = False
    except Exception:
        demonized = False
        undead = False

    # End function if player is dead (exit condition for recursion)
    if user_role in ['Dead', 'Spectator', 'Suspended', None, 'Unknown']:
        return answer.log_add(recursive + success +
                              '<@{}> was already dead!'.format(user_id))

    if role == 'Cupid':
        answer.log_add(recursive + success + skull +
                       '<@{}> committed suicide.'.format(user_id))
        answer = instant_death(user_id, role, 'Cupid', answer,
                               recursive + next)
        if int(db_get(user_id, 'abducted')) != int(db_get(
                murderer, 'abducted')):
            answer.dm("Abducted or not, you know your lover has deceased! ",
                      user_id)
            answer.dm_add(
                "You couldn't handle the pain, and that's why you decided to put an end to it.\n"
            )
            answer.dm_add("Your story ends here.")
        elif int(db_get(user_id, 'frozen')) == 1:
            answer.dm(
                "Even though your heart has become cold from the ice surrounding you, ",
                user_id)
            answer.dm_add(
                "but it got even colder when you saw the dead body of <@{}> being carried away.\n"
                .format(murderer))
            answer.dm_add(
                "It was at this moment where the ice got even colder...")
        else:
            answer.dm(
                "You couldn't bear the sight of your lover, <@{}>, ".format(
                    murderer), user_id)
            answer.dm_add(
                "lying dead in your arms. This is why you have decided to end it all!\n"
            )
            answer.dm_add(
                "Let\'s just hope this isn\'t like Romeo and Juliet...")
        answer.dm_add(
            "**Your lover, <@{}>, has died. In response, you have committed suicide.**"
            .format(murderer))
        return answer

    if role == 'Fortune Teller':
        if not undead:
            answer.dm(
                "Your idol, the fortune teller <@{}>, has deceased. ".format(
                    murderer), db_get(user_id, 'channel'))
            answer.dm_add(
                "They were a great inspiration to you, and that's why ")
            answer.dm_add("you've decided to get in their footsteps!\n")
            answer.dm_add("**You have turned into a Fortune Teller. Find and ")
            answer.dm_add(
                "eliminate all werewolves, solo players and other enemies!**")
            answer.log_add(recursive + success +
                           '<@{}> became a fortune teller.')
        else:
            answer.dm(
                "Your idol, the fortune teller <@{}>, has deceased. ".format(
                    murderer), user_id)
            answer.dm_add("They were a great inspiration to you... ")
            answer.dm_add(
                "back when you were alive, at least. Now, your undead heart is as cold as it has ever been, "
            )
            answer.dm_add("and nothing will happen to you.\n")
            answer.dm_add(
                "**The rules have changed. You will remain Undead.**")
            answer.log_add(recursive + success +
                           '<@{}> failed to become a fortune teller.')
            db_set(user_id, 'role', 'Fortune Teller')
        return answer

    if role == 'Horseman' and user_role == 'Horseman':
        horse_number = db_get(user_id, 'horseman')
        apocalypse_ready = True
        for player in db.player_list():
            if int(db_get(player, 'horseman')) != 0:
                apocalypse_ready = False
            if int(db_get(player, 'horseman')) == horse_number:
                db_set(player, 'horseman', 0)
        answer.log_add(recursive + success +
                       '<@{}> was united.'.format(user_id))

        if horse_number != 0:
            for channel_id in db.get_secret_channels('Horseman'):
                answer.msg(
                    '**Horseman #{} has been united!**'.format(horse_number),
                    channel_id)

        if apocalypse_ready:
            for player in db.player_list():
                if db_get(player, 'role') == 'Horseman':
                    answer.log_add(recursive + next + failure)
                    answer.log_add(recursive + next + success +
                                   '<@{}> has joined the **Apocalypse**!')
                    db_set(player, 'horseman', 5)

                    answer.secret_dm(
                        'All Horsemen are united! This means that the **APOCALYPSE** can be unleashed!',
                        'Horseman')
            answer.story('Oh no! The Apocalypse has been unleashed!')
        return answer

    # End if user is frozen.
    if int(db_get(user_id, 'frozen')) == 1:
        return answer.log_add(
            recursive + success +
            '<@{}> was frozen and thus protected.'.format(user_id))

    if role == "Devil":
        if user_role == 'Devil':
            answer.log_add(recursive + success +
                           '<@{}> did not die to their own wage.')
            return answer
        answer.log_add(recursive + success + skull +
                       '<@{}> was killed by the wager.')
        answer = instant_death(user_id, role, 'Wager', answer,
                               recursive + next)
        return answer

    # Let all zombies kill all other zombies.
    if role == "Zombie":
        answer.log_add(recursive + success + skull +
                       '<@{}> has decayed.'.format(user_id))
        answer = instant_death(user_id, role, 'Zombie', answer,
                               recursive + next)
        return answer

    # Kill abducted players (or The Thing himself)
    if role == "The Thing":
        answer.log_add(recursive + success + skull +
                       '<@{}> drowned in the swamp.'.format(user_id))
        # TODO: kill the player (BUT NOT THROUGH THE SUICIDE FUNCTION)
        return answer

    # End if user is immortal.
    if user_role == "Immortal":
        answer.log_add(recursive + success +
                       '<@{}> is immortal.'.format(user_id))
        return answer

    # End if user is abducted.
    if int(db_get(user_id, 'abducted')) == 1:
        return answer.log_add(
            recursive + success +
            '<@{}> was abucted and thus protected.'.format(user_id))

    # Kill lynch!
    if role == "Innocent":
        replacements = [
            standoff for standoff in db.get_standoff(user_id)
            if standoff[2] == 'Executioner'
        ]

        if replacements == []:
            answer.log_add(recursive + success + skull +
                           '<@{}> was killed by an angry mob.'.format(user_id))
            answer = instant_death(user_id, role, 'Lynch', answer,
                                   recursive + next)

        else:
            answer.log_add(recursive + success +
                           '<@{}> escaped death as the Executioner.')

            if user_role == 'Executioner':
                db_set(user_id, 'role', 'Innocent')

            for standoff in replacements:
                db.delete_standoff(standoff[0])
                answer = instant_death(standoff[1], standoff[2], 'Lynch',
                                       answer, recursive + next)

        return answer

    # Kill whoever stands in the barber's way!
    if role == "Barber":
        if user_role != 'Idiot':
            answer.log_add(recursive + success + skull +
                           '<@{}> was cut to death.'.format(user_id))
            answer = instant_death(user_id, role, 'Barber', answer,
                                   recursive + next)
            answer.story(barber_kill_story(murderer, user_id))

        else:
            msg = "*\"Tomorrow, at noon, right here. You got that?\"* Yup, it definitely seemed like <@{}> ".format(
                user_id)
            msg += "remembered the barber\'s appointment.\nIt was only today that it turned out - they had forgotten "
            msg += "about it! Good thing for them, for <@{}> had the intent to cut a little far below the hairline...\n".format(
                murderer)
            msg += "**<@{0}>, the Barber, has failed to execute <@{1}>, the Idiot! <@{0}> will now continue the game ".format(
                murderer, user_id)
            msg += "as a regular Innocent, and <@{}> as an even better Idiot, as they are no longer allowed to vote.**".format(
                user_id)
            answer.story(msg).log_add(
                recursive + success +
                '<@{}> failed to give <@{}> a \"haircut\".'.format(
                    murderer, user_id))
            db_set(user_id, 'role', 'Idiot ')

        return answer

    # Save users if they have souls to spare.
    souls = int(db_get(user_id, 'souls'))
    if souls > 0:
        db_set(user_id, 'souls', souls - 1)
        answer.log_add(recursive + success +
                       '<@{}> lost a soul.'.format(user_id))
        return answer

    # End if the user sleeps with another.
    if role == "Hooker" and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was slept with <@{}>.'.format(user_id, murderer))
        answer = instant_death(user_id, role, 'Hooker', answer,
                               recursive + next)
        return answer

    # End if player dies in someone else's place.
    if role == "Executioner":
        answer.log_add(recursive + success + skull +
                       '<@{}> was executed.'.format(user_id))
        answer = instant_death(user_id, role, 'Executioner', answer,
                               recursive + next)
        return answer

    # End if player dies in someone else's place.
    if role == "Huntress" and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was shot.'.format(user_id))
        answer = instant_death(user_id, role, 'Huntress', answer,
                               recursive + next)
        return answer

    # Check if user has an amulet.
    if db.has_amulet(user_id) and role not in ['Hooker']:
        return answer.log_add(
            recursive + success +
            "<@{}> was protected by their amulet.".format(user_id))

    # Protect apocalypse horsemen
    if int(db_get(user_id, 'horseman')) == 5:
        return answer.log_add(
            '<@{}> was protected by the Apocalypse.'.format(user_id))

    # Kill assassinations
    if role == 'Assassin' and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was assassinated.'.format(user_id))
        answer = instant_death(user_id, role, 'Assassin', answer,
                               recursive + next)
        return answer
    if role == 'Cult Leader' and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was killed by the cult.'.format(user_id))
        answer = instant_death(user_id, role, 'Cult', answer, recursive + next)
        return answer
    if role == 'Priest' and not demonized:
        if user_role in pos.wolf_team:
            answer.log_add(recursive + success + skull +
                           '<@{}> was holified.'.format(user_id))
            answer = instant_death(user_id, role, 'Priest', answer,
                                   recursive + next)
        else:
            answer.log_add(recursive + success + skull +
                           '<@{}> holified themselves.'.format(murderer))
            answer = instant_death(user_id, role, 'Priest', answer,
                                   recursive + next)
        return answer
    if role == 'Witch' and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was poisoned.'.format(user_id))
        answer = instant_death(user_id, role, 'Witch', answer,
                               recursive + next)
        return answer

    # Kill wolf attacked
    if role in ['Werewolf', 'Lone Wolf', 'White Werewolf']:
        if user_role == 'Runner':
            answer.log_add(recursive + success +
                           '<@{}> outran a wolf attack.'.format(user_id))
            answer.dm('You. Are. EXHAUSTED.\n', user_id)
            answer.dm_add(
                'Last night may have been the worst night of your life! ')
            answer.dm_add(
                'You\'re still alive, however. And that\'s what counts. ')
            answer.dm_add(
                'Let\'s hope that, whatever those creatures were, won\'t attack again tomorrow night!\n'
            )
            answer.dm_add(
                '**Last night, you have been attacked by a wolf. You have become a regular Innocent.**'
            )
            db_set(user_id, 'role', 'Innocent')
            return answer
        if user_role == 'Cursed Civilian':
            answer.dm(
                "The curse that went around you, had been a little itchy lately... and it kept getting worse! ",
                user_id)
            answer.dm_add(
                "It got worse and worse, and you couldn't help but notice how hair started growing everywhere!\n"
            )
            answer.dm_add(
                "Last night, you were waking up by the grunts of a what sounded like a wolf! "
            )
            answer.dm_add(
                "You thought your days were over, but the wolf did not attack. Instead, "
            )
            answer.dm_add(
                "the wolf watched as your nails grew longer, your ears became spiky and your smell "
            )
            answer.dm_add(
                "slowly improved... and you looked just like one of the silhouettes in the shadow, "
            )
            answer.dm_add(
                "waiting for you to join them in the beautiful night's sky...\n"
            )
            answer.dm_add(
                "**You have been visited by wolves last night, and your curse made you turn "
            )
            answer.dm_add(
                "into a werewolf. Devour all villagers and win the game!**")

            db_set(user_id, 'role', 'Werewolf')
            answer.log_add(recursive + success +
                           '<@{}> has turned into a Werewolf!'.format(user_id))

            for channel_id in db.get_secret_channels('Werewolf'):
                answer.edit_cc(channel_id, user_id, 1)
                answer.msg("**ARRROOOO!\nWelcome, <@{}>!**".format(user_id),
                           channel_id)
                answer.msg_add(
                    "Last night, the **cursed civilian** <@{}> was attacked by wolves, "
                    .format(user_id))
                answer.msg_add(
                    "and has now become a **werewolf**! Please, welcome this new member "
                )
                answer.msg_add("of the wolf pack!")
            return answer
        if not demonized:
            answer.log_add(recursive + success + skull +
                           '<@{}> was eaten by a werewolf.'.format(user_id))
            answer = instant_death(user_id, role, 'Werewolf', answer,
                                   recursive + next)
            return answer

    # Kill solo attacked
    if role == 'Demon' and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was sent to hell.'.format(user_id))
        answer = instant_death(user_id, role, 'Demon', answer,
                               recursive + next)
        return answer
    if role == 'Horseman' and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> was apocalypsed.'.format(user_id))
        answer = instant_death(user_id, role, 'Horseman', answer,
                               recursive + next)
        return answer
    if role == 'Pyromancer' and not demonized:
        answer.log_add(recursive + success + skull +
                       '<@{}> went up in flames.'.format(user_id))
        answer = instant_death(user_id, role, 'Pyromancer', answer,
                               recursive + next)
        return answer

    # Assume they were supposed to be killed, but that they are demonized. Let's turn them undead!
    answer.log_add(recursive + success + skull + '<@{}> has become undead.')

    db_set(user_id, 'undead', 1)
    answer.dm(
        "Last night, you didn't feel to well and decided to go out, to take a walk. ",
        user_id)
    answer.dm_add(
        "As soon as you stepped out the door, you felt like it was a bad idea - and it was!\n"
    )
    answer.dm_add(
        "The last thing you can remember is the sound of someone approaching you from behind, "
    )
    answer.dm_add(
        "the sound of a skull cracking open, and then - **NOTHING**.\n\n")
    answer.dm_add("Is this the end?\n\n")
    answer.dm_add(
        "It doesn't appear so. You wake up in a graveyard. A few cold and grim silhouettes "
    )
    answer.dm_add(
        "stand in front of you. You are surrounded, but it feels more... welcoming. "
    )
    answer.dm_add("And then the truth arrives.\n")
    answer.dm_add(
        "The **{}** you once were, is dead. Their soul could not rest, and that is you. "
    )
    answer.dm_add("The remainders of something that wasn't ready to die.\n")
    answer.dm_add(
        "**You have become Undead. Murder everyone that isn't an undead or a vampire."
    )

    for channel_id in db.get_secret_channels('Undead'):
        answer.edit_cc(channel_id, user_id, 1)
        answer.msg(
            "Last night, <@{}>, a **{}** has died! Please welcome them in the realm of the Undead!",
            channel_id)

    if user_role not in pos.pretenders:
        db_set(user_id, 'role', 'Undead')
        answer.dm_add("**")
    else:
        answer.dm_add(
            " Your former teammates do not know you are Undead, so make use of this advantage.**"
        )

    return answer
Exemple #21
0
def todo(user_id):
    return Mailbox().dm(
        "I am terribly sorry! You cannot use this item yet, because it hasn't been implemented yet!",
        user_id, True)
Exemple #22
0
def use_item(item_code, message):
    user_id = message.author.id
    if not inventory.has_item(user_id, item_code):
        return Mailbox().dm(
            "I'm sorry. You do not have the correct item in your inventory!",
            user_id, True)

    # Invisibility cloak
    if item_code == 100:
        if not db.isParticipant(user_id):
            return Mailbox().dm(
                "You are not a participant! You cannot protect yourself if you're not playing.",
                user_id, True)

        db.db_set(user_id, 'sleepingover', 1)
        inventory.give_item(user_id, 100, -1)
        return Mailbox().dm(
            "You are protected for the night. No-one should be able to find you...",
            user_id
        ).log(
            "<@{}> has used an invisibility cloak to protect themselves for the night!"
            .format(user_id))

    # Bucket of water
    if item_code == 101:
        if not db.isParticipant(user_id):
            return Mailbox().dm(
                "You are not a participant! You cannot unpowder yourself if you're not playing.",
                user_id)

        inventory.give_item(user_id, 101, -1)
        answer = Mailbox().dm(
            "The bucket of water refreshed your senses. If you were powdered, this effect has been undone!",
            user_id)
        if int(db.db_get(user_id, 'powdered')) == 1:
            answer.log(
                "<@{}> has used a bucket of water. They are no longer powdered!"
                .format(user_id))
        else:
            answer.log(
                "<@{}> has used a bucket of water - they weren't powdered, however."
                .format(user_id))
        db.db_set(user_id, 'powdered', 0)
        return answer

    # Royal sword
    if item_code == 102:
        # TODO
        return todo(user_id)

    # Disguise
    if item_code == 103:
        if not db.isParticipant(user_id):
            return Mailbox().dm(
                "You are not a participant! You cannot disguise anyone if you're not playing.",
                user_id, True)

        role = check.roles(message, 1)
        if not role:
            return Mailbox().dm(
                "**INVALID SYNTAX:** No role provided! Please provide a role!",
                user_id, True)

        victim_id = check.users(message, 1, True, True)
        if not victim_id:
            victim_id = [user_id]
        victim_id = victim_id[0]

        user_role = db.db_get(user_id, 'role')

        victim_role = db.db_get(victim_id, 'role')
        victim_frozen = int(db.db_get(victim_id, 'frozen'))
        victim_abducted = int(db.db_get(victim_id, 'abducted'))

        if victim_abducted == 1:
            return Mailbox().dm(
                "After having finished your great disguise, it seems like you couldn\'t find your target! Where have they gone off to?",
                user_id, True)
        if victim_frozen == 1:
            return Mailbox().dm(
                "I am sorry, but <@{}> is too cold for that! You\'ll need a lot more than warm suit to get \'em warmed up."
                .format(victim_id), user_id, True)

        db.db_set(victim_id, 'fakerole', role)
        inventory.give_item(user_id, 103, -1)
        answer = Mailbox().dm(
            "You have successfully disguised <@{}> as the **{}**!".format(
                victim_id, role), user_id)

        answer.log(
            "With a disguise from their inventory, **{}** <@{}> has disguised <@{}>, the **{}**, as the **{}**!"
            .format(user_role, user_id, victim_id, victim_role, role))
        if victim_role == role:
            answer.log_add(
                "\n...does that sound stupid? *Of course!* But how are they supposed to know?"
            )
        return answer

    # Name tag
    if item_code == 104:
        # TODO
        return todo(user_id)

    # Med kit
    if item_code == 105:
        pass

    # Dagger
    if item_code == 106:
        if not db.isParticipant(user_id):
            return Mailbox().dm(
                "You are not a participant! You cannot attack anyone if you're not playing.",
                user_id, True)

        if user_id == victim_id:
            return Mailbox().respond(
                "I am sorry, but you cannot attempt suicide!\nNot because it's not an option, no, just because we want to see you SUFFER!",
                True)

        if int(db.db_get(victim_id, 'abducted')) == 1:
            return Mailbox().respond(
                "You attempted to attack <@{}>... but they don't seem to be around in town! That is strange."
                .format(victim_id), True)
        if int(db.db_get(victim_id, 'frozen')) == 1:
            return Mailbox().respond(
                "You wanted to pay a visit to <@{}>... but it seems they were frozen! Try again, please."
                .format(victim_id), True)

        inventory.give_item(user_id, 106, -1)
        db.add_kill(victim_id, 'Assassin', user_id)

        answer = Mailbox().dm(
            "You have successfully used a **Dagger** to assasinate <@{}>. They will die when the time shifts!",
            user_id, True)
        return answer.log(
            "<@{}> has used a **Dagger** to assassinate <@{}>.".format(
                user_id, victim_id))
def start_game():
    """This function is triggered at the start of the game. If successful, the function returns a Mailbox.
    If unsuccessful, the function still returns a Mailbox, but will also confirm the error in the console."""

    # Make sure there isn't already a game going on!
    if dy.get_stage() != "NA":
        print("ERROR: According to " + dy.dynamic_config +
              ", there's already a game going on!")
        return Mailbox().respond(
            "I'm sorry! A game cannot be started while there's another one going on already!"
        )

    # Choose the roles out of the given role-pool
    role_pool = []
    for choice in view_roles():
        for i in range(choice.amount):
            role_pool.append(choice.role)

    if len(db.player_list()) > len(role_pool):
        print(
            "The game cannot be started while there are less roles available than that there are participants signed up."
        )
        return Mailbox().respond("Not enough roles to distribute available!",
                                 True)

    # If there are enough roles available, make a selection, evaluate the selection, and, if accepted, distribute the roles.
    if not pos.valid_distribution(role_pool, True):
        return Mailbox().respond(
            "I am sorry, but I cannot use an invalid distribution to start the game!",
            True)

    answer = Mailbox(True)

    attempts = 0
    while attempts < 1000:
        attempts += 1
        chosen_roles = random.sample(role_pool, len(db.player_list()))

        if pos.valid_distribution(chosen_roles, True) == True:

            answer.create_cc("Graveyard", 0, [], [], True)
            answer.create_cc("Market", 0, [], [], True)
            answer.create_cc("Reporter", 0, [], [], True)

            # Assign the roles to all users.
            user_list = db.player_list()

            for i in range(len(user_list)):
                user_id = user_list[i]
                user_role = chosen_roles[i]

                db_set(user_id, 'role', user_role)
                db_set(user_id, 'fakerole', user_role)
                db_set(user_id, 'channel', config.game_log)

                answer.log(
                    "{} - <@{}> has received the role of the `{}`!".format(
                        db_get(user_id, 'emoji'), user_id, user_role))
                answer.dm(
                    "This message is giving you your role for season `{}` of the *Werewolves* game.\n\n"
                    .format(config.season), user_id)
                answer.dm_add('Your role is `{}`.\n\n'.format(user_role))
                answer.dm_add(
                    "**You are not allowed to share a screenshot of this message!** "
                )
                answer.dm_add(
                    "You can claim whatever you want about your role, but you may under **NO** "
                )
                answer.dm_add(
                    "circumstances show this message in any way to any other participants.\n"
                )
                answer.dm_add(
                    "We hope you are happy with the role you gained, and we hope you'll enjoy the game as much as we do.\n\n"
                )
                answer.dm_add("Good luck... 🌕")

                if user_role in pos.personal_secrets:
                    answer.create_sc(user_id, user_role)
                if user_role in pos.shared_secrets:
                    answer.add_to_sc(user_id, user_role)

                if user_role == "Cult Member":
                    answer.add_to_sc(user_id, "Cult Leader")
                if user_role in pos.wolf_pack:
                    answer.add_to_sc(user_id, "Werewolf")
                if user_role == "Bloody Butcher":
                    answer.add_to_sc(user_id, "Butcher")
                if user_role == "Devil":
                    answer.add_to_sc(user_id, "Demon")
                if user_role == "Vampire":
                    answer.add_to_sc(user_id, "Undead")
                if user_role == "Witch":
                    db_set(user_id, 'uses', 3)

            answer.story(
                'The current distribution is {}'.format(chosen_roles))  # TODO
            answer.story(
                'I know, I know. That looks ugly as hell. We\'re trying to make it look good!'
            )

            if "Flute Player" in chosen_roles:
                answer.create_cc("Flute_Victims", 0, [], [], True)

            # If the four horsemen are part of the game, assign numbers to all players.
            if "Horseman" in chosen_roles:
                nothorse_table = [
                    user_id for user_id in db.player_list()
                    if db_get(user_id, 'role') != 'Horseman'
                ]
                horse_table = [
                    user_id for user_id in db.player_list()
                    if db_get(user_id, 'role') == 'Horseman'
                ]

                nothorse_table.shuffle()
                horse_table.shuffle()

                for i in range(4):
                    db_set(horse_table[i], 'horseman', i + 1)

                for i in range(16):
                    db_set(nothorse_table[i], 'horseman', (i % 4) + 1)

            # Reset the day timer
            dy.reset_day()
            dy.set_stage('Night')

            return answer.respond(
                "Very well! The game will start tomorrow morning.")

    answer.respond("Timeout reached! Your distribution is too crazy!", True)
    return answer
Exemple #24
0
def seek(user_id, victim_id, role):
    """This fuction allows the crowd seeker to inspect players.
    The function assumes the player is a participant and has the correct role, so make sure to have filtered this out already.
    The function returns a Mailbox.

    user_id -> the player who casts the spell
    victim_id -> the player upon whom the spell is cast
    role -> the role the player will be checked as"""

    uses = int(db_get(user_id, 'uses'))
    if uses < 1:
        return Mailbox().respond(
            "I am sorry! You currently don't have the ability to seek anyone!",
            True)

    user_channel = int(db_get(user_id, 'channel'))
    user_undead = int(db_get(user_id, 'undead'))

    victim_role = db_get(victim_id, 'fakerole')
    victim_frozen = int(db_get(victim_id, 'frozen'))
    victim_abducted = int(db_get(victim_id, 'abducted'))

    if user_undead == 1:
        return Mailbox().dm(
            "I am sorry! You are undead, meaning you can no longer seek players!",
            user_id, True)
    if victim_abducted == 1:
        return Mailbox().msg(
            "You appear to be unable to find <@{}> among the crowds! Where could they be?"
            .format(victim_id), user_channel, True)
    if victim_frozen == 1:
        return Mailbox().msg(
            "<@{}> was isolated from the crowd, and has gotten too cold to seek. Please try someone else!"
            .format(victim_id), user_channel, True)

    db_set(user_id, 'uses', uses - 1)
    answer = Mailbox()

    if role == victim_role:
        answer.msg(
            "{} - <@{}> has the role of the **{}**!".format(
                db_get(victim_id, 'emoji'), victim_id, role), user_channel)
        answer.log(
            "The **Crowd Seeker** <@{}> has seen <@{}> as the **{}**!".format(
                user_id, victim_id, role))
    else:
        answer.msg(
            "{} - <@{}> does **NOT** have the role of the **{}**.".format(
                db_get(victim_id, 'emoji'), victim_id, role), user_channel)
        answer.log(
            "The **Crowd Seeker** <@{}> guessed incorrectly that <@{}> would be the **{}**."
            .format(user_id, victim_id, role))

    if uses - 1 > 0:
        answer.msg("You can seek **{}** more time".format(uses - 1),
                   user_channel, True)
        if uses - 1 > 1:
            answer.msg_add("s")
        answer.msg_add("!")
    else:
        answer.msg("That\'s it for today! You cannot seek any more players.",
                   user_channel, True)

    return answer
Exemple #25
0
def freeze_all(user_id):
    """This function allows the ice king to potentially freeze all their guessed players.
    The function assumes the ice king is a participant, so make sure to have filtered this out already.
    The function returns a Mailbox.

    Keyword arguments:
    user_id -> the ice king's id"""

    uses = int(db_get(user_id, 'uses'))
    if uses < 1:
        return Mailbox().respond(
            "I am sorry! You currently don't have the ability to submit a freezing list!",
            True)
    db_set(user_id, 'uses', uses - 1)

    user_channel = int(db_get(user_id, 'channel'))
    user_undead = int(db_get(user_id, 'undead'))
    correct = 0
    incorrect = 0

    for frozone in db.get_freezers(user_id):
        if not db.isParticipant(frozone[0]) or int(
                db_get(frozone[0], 'abducted')) == 1:
            db.delete_freezer(user_id, frozone[0])
        elif frozone[1] != db_get(frozone[0], 'role'):
            incorrect += 1
        else:
            correct += 1

    if user_undead == 1:
        answer = Mailbox().msg(
            "You have submitted a list that contains {} players. The result was **unsuccessful**. "
            .format(correct + incorrect), user_channel)
        answer.msg_add("This means that at least one role was incorrect!")
        answer.log(
            "The **Undead** <@{}> has pretended to submit a freeze list.".
            format(user_id))
        answer.dm(
            "Hey, you're **Undead**, so this list would've failed anyway - but this helps a little to keep up your cover! 😉",
            user_id)
        return answer

    if incorrect > 0:
        answer = Mailbox().msg(
            "You have submitted a list that contains {} players. The result was **unsuccessful**. "
            .format(correct + incorrect), user_channel)
        answer.msg_add("This means that at least one role was incorrect!")
        answer.log(
            "The **Ice King** <@{}> has submitted an **unsuccessful** freeze list. "
            .format(user_id))
        answer.log_add(
            "The list contained {} guesses, of which {} were correct.".format(
                incorrect + correct, correct))
        return answer

    # This will execute if all users on the list are correct.
    answer = Mailbox().msg(
        "You have submitted a list that contains {} players. The result was **successful**!\n"
        .format(correct), user_channel)
    if correct > 4:
        answer.msg_add(
            "Congratulations! You guessed them all correctly! ").msg_react('🎉')
    answer.msg_add("Your guessed users will now be frozen.")

    for supersuit in db.get_freezers(user_id):
        db.delete_freezer(user_id, supersuit[0])
        answer.freeze(supersuit[0])

    return answer
def pay():
    """This function takes care of all properties that need to happen in the first wave of the end of the night.
    The function returns a Mailbox."""

    if dy.get_stage() == "Day":
        return [
            Mailbox().respond(
                "Whaddaya mean, `{}pay`? It already **is** day, bud.".format(
                    config.universal_prefix))
        ]

    answer = Mailbox()
    answer_table = [Mailbox(True)]
    for user_id in db.player_list():
        user_role = db_get(user_id, 'role')

        # Remove potential night uses
        for i in range(len(roles.night_users)):
            if user_role in roles.night_users[i]:
                if i > 0:
                    db_set(user_id, 'uses', 0)
                break

        # Force Cupid to fall in love
        if user_role == "Cupid" and db_get(user_id, 'uses') > 0:
            chosen = False
            attempts = 0

            while not chosen and attempts < 1000:
                forced_victim = random.choice(db.player_list(True, True))
                chosen = cupid_kiss(user_id, forced_victim, False)

            answer_table.append(chosen)

        # Force Dog to become Innocent
        if user_role == "Dog" and db_get(user_id, 'uses') > 0:
            db_set(user_id, 'role', "Innocent")
            answer.msg(
                "You haven't chosen a role! That's why you have now become and **Innocent**!",
                db_get(user_id, 'channel'))
            answer.log(
                "The **Dog** <@{}> didn't choose a role last night and turned into an **Innocent**!"
                .format(user_id))

        # Remove hooker effects
        db_set(user_id, 'sleepingover', 0)
        for standoff in db.get_standoff(user_id):
            if standoff[2] == 'Hooker':
                db.delete_standoff(standoff[0])

        # Force Look-Alike to become Innocent
        if user_role == "Look-Alike":
            db_set(user_id, 'role', "Innocent")
            answer.msg(
                "You haven't chosen a role! That's why you have now become an **Innocent**!",
                db_get(user_id, 'channel'))
            answer.log(
                "The **Dog** <@{}> didn't choose a role last night and turned into an **Innocent**!"
                .format(user_id))

        # Remove tanner disguises
        db_set(user_id, 'fakerole', user_role)

        # Remove zombie tag
        db_set(user_id, 'bitten', 0)

    answer_table.append(answer)
    return answer_table
def night():
    """Start the second part of the day.  
    The function assumes all polls have been evaluated, and that looking after attacks can begin.  
    The function returns a Mailbox."""
    threat = db.get_kill()
    answer = Mailbox().log("**Results from daily deaths:**")

    if dy.get_stage() == "Night":
        return Mailbox().respond("Sure, man. Whatever.")

    while threat != None:

        answer = roles.attack(threat[1], threat[2], threat[3], answer)
        threat = db.get_kill()

    for player in db.player_list(True):
        # Give potential night uses
        user_role = db_get(player, 'role')
        for i in range(len(roles.night_users)):
            if user_role in roles.night_users[i]:
                # Give one-time users their one-time power
                if i == 0:
                    if dy.day_number() == 0:
                        db_set(player, 'uses', 1)
                    break

                db_set(player, 'uses', i)
                answer.msg(power.power(user_role), db_get(player, 'channel'))
                break

    answer.story(evening.evening(db.get_deadies()))
    db.delete_deadies()

    # Add polls
    for player in db.player_list():
        if db_get(player, 'role') in pos.wolf_pack:
            for channel_id in db.get_secret_channels('Werewolf'):
                answer.new_poll(channel_id, 'wolf', db.random_wolf(),
                                story_text('wolf'))
            break
    for player in db.player_list():
        if db_get(player, 'role') == 'Cult Leader':
            for channel_id in db.get_secret_channels('Cult_Leader'):
                answer.new_poll(channel_id, 'cult', db.random_cult(),
                                story_text('cult'))
            break
    for channel_id in db.get_secret_channels('Swamp'):
        answer.new_poll(channel_id, 'thing', '', story_text('thing'))

    answer.log("```Night {}```".format(dy.day_number()))
    dy.set_stage("Night")

    return answer
Exemple #28
0
def todo():
    return [Mailbox().spam("I am terribly sorry! This command doesn't exist yet!",True)]
def day():
    """Start the second part of the day.  
    The function assumes all polls have been evaluated, and that looking after attacks can begin.  
    The function returns a Mailbox."""
    threat = db.get_kill()
    answer = Mailbox().log("**Results from night attacks:**")

    if dy.get_stage() == "Day":
        return Mailbox().respond("Sure, man. Whatever.")

    while threat != None:

        answer = roles.attack(threat[1], threat[2], threat[3], answer)
        threat = db.get_kill()

    for player in db.player_list(True):
        # Give potential day uses
        user_role = db_get(player, 'role')
        for i in range(len(roles.day_users)):
            if user_role in roles.day_users[i]:
                # Give one-time users their one-time power
                if i == 0:
                    if dy.day_number() == 0:
                        db_set(player, 'uses', 1)
                    break

                db_set(player, 'uses', i)
                answer.msg(power.power(user_role), db_get(player, 'channel'))
                break

    answer.story(morning.story_time(db.get_deadies()))
    db.delete_deadies()
    db.delete_hookers()

    # Add polls
    if dy.day_number() != 0:
        answer.new_poll(dy.voting_booth(), 'lynch', '', story_text('lynch'))
    if dy.get_mayor() == 0:
        answer.new_poll(dy.voting_booth(), 'Mayor', '', story_text('Mayor'))
    elif dy.get_reporter() == 0:
        answer.new_poll(dy.voting_booth(), 'Reporter', '',
                        story_text('Reporter'))

    dy.next_day()
    dy.set_stage('Day')
    answer.log("```Day {}```".format(dy.day_number()))

    return answer
Exemple #30
0
def process(message, isGameMaster = False):

    user_id = message.author.id
    message_channel = message.channel.id
    user_role = db_get(user_id,'role')

    '''testcc'''
    # This function is merely a temporary one, to test if the cc creation command is working properly.
    if is_command(message,['cc','testcc','test_cc']):
        members = check.users(message)
        if len(message.content.split(' ')) == 1 or members == False:
            msg = "**Incorrect syntax:** `" + prefix + "cc <name> <user> <user> <user> ...`\n\nExample: `" + prefix + "cc the_cool_ones @Randium#6521`"
            msg += "\n\nThe bot understands both mentions and emojis linked to players."
            return [Mailbox().respond(msg,True)]
        name = message.content.split(' ')[1]
        return [Mailbox().create_cc(name,user_id,members)]
    if is_command(message,['cc','testcc','test_cc'],True):
        msg = "**Usage:** `" + prefix + "cc <name> <user> <user> <user> ...`\n\nExample: `" + prefix + "cc the_cool_ones @Randium#6521`"
        msg += "\n\nThe bot understands both mentions and emojis linked to players."
        return [Mailbox().respond(msg,True)]

    # =============================================================
    #
    #                         GAME MASTERS
    #
    # =============================================================
    if isGameMaster == True:

        '''addrole'''
        # Before the game starts, a list of roles is kept track of.
        # That list is the list of roles that will be dealt among the participants.
        # If the list is greater than the amount of participants, some random roles will be left out.
        # The game cannot start as long as this list is incomplete.
        if is_command(message,['addrole']):
            # TODO
            return todo()
        if is_command(message,['addrole'],True):
            # TODO
            return todo()

        '''assign'''
        # This command is used at the start of the game to assign all roles.
        # This will actually set their "fakerole" value, which will be transferred to their actual role once the game starts.
        if is_command(message,['assign']):
            role = check.roles(message,1)[0]
            user = check.users(message,1)[0]

            if role == False:
                return [Mailbox().respond("No role provided! Please provide us with a role!")]
            if user == False:
                return [Mailbox().respond("No user found! Please provide us with a user!")]

            db_set(user,'role',role)
            return [Mailbox().spam("You have successfully given <@{}> the role of the `{}`!".format(user,role))]

        if is_command(message,['assign'],True):
            msg = "**Usage:** `" + prefix + "assign <user> <role>`\n\nExample: `" + prefix
            msg += "assign @Randium#6521 Innocent`\nGame Master only command"
            return [Mailbox().spam(msg)]

        '''day'''
        # This command is used to initialize the day.
        if is_command(message,['day']):
            # TODO
            return todo()
        if is_command(message,['day'],True):
            # TODO
            return todo()

        '''open_signup'''
        # This command is started when a new game can be started.
        # Make sure the bot has reset itself beforehand.
        if is_command(message,['open_signup']):
            # TODO
            return todo()
        if is_command(message,['open_signup'],True):
            # TODO
            return todo()

        '''whois'''
        # This command reveals the role of a player.
        # To prevent spoilers, the response isn't made in the message's channel, but rather in the bot spam channel.
        if is_command(message,['whois']):
            user_table = check.users(message)
            identities = Mailbox()

            if user_table == False:
                return [Mailbox().respond("**ERROR:** No user provided!")]

            for user in user_table:
                emoji = db_get(user,'emoji')
                role = db_get(user,'role')
                if emoji == None or role == None:
                    identities.spam("**ERROR:** Could not find user <@{}> in database.".format(user))
                else:
                    msg = "{} - <@{}> has the role of the `{}`!".format(emoji,user,role)
                    identities.spam(msg)

            return [identities]

        if is_command(message,['whois'],True):
            msg = "**Usage:** `" + prefix + "whois <user1> <user2> ...`\n\n"
            msg += "Example: `" + prefix + "whois @Randium#6521`\nGame Master only command"
            return [Mailbox().respond(msg,True)]

    # =============================================================
    #
    #                         PARTICIPANTS
    #
    # =============================================================

    if isParticipant(user_id):

        '''add'''
        # This command allows users to add users to a conspiracy.
        # This command will not trigger if the user doesn't own the conspiracy channel.
        if is_command(message,['add']):
            members_to_add = check.users(message)
            if members_to_add == False:
                return [Mailbox().respond("I am sorry! I couldn't find the user you were looking for!",True)]
            if is_owner(user_id,message.channel.id) == False:
                return [Mailbox().respond("I\'m sorry, you can only use this in conspiracy channels where you are the owner!")]
            command = Mailbox()
            for x in members_to_add:
                command.edit_cc(x,channel_id,1)
            return [command.respond("Insert Randium's comment here")]

        if is_command(message,['add'],True):
            # TODO
            return todo()

        '''cc'''
        # This command allows users to create a conspiracy channel.
        if is_command(message, ['cc']):
            if len(message.content.split(' ')) < 2:
                    return [Mailbox().respond("**Invalid syntax:**\n\n`" + prefix + "cc <name> <user1> <user2> <user3> ...`\n\n**Example:** `" + prefix + "cc the_cool_guys @Randium#6521`")]

            channel_members = check.users(message)
            if channel_members == False:
                channel_members = []
            if user_id not in channel_members:
                channel_members.append(user_id)

            num_cc_owned = int(db_get(user_id,'ccs'))

            if num_cc_owned >= max_cc_per_user:
                answer = Mailbox().dm("You have reached the amount of conspiracy channels one may own!", user_id)
                return answer.dm("If you want more conspiracy channels, please request permission from one of the Game Masters.", user_id)

            db_set(user_id,'ccs',number_cc_owned + 1)
            return Mailbox.create_cc(message.content.split(' ')[1], user_id, channel_members)

        if is_command(message,['cc'],True):
            # TODO
            return todo()

        '''info'''
        # This command allows users to view information about a conspiracy channel.
        # Says the user must be in a cc if they're not.
        if is_command(message,['info']):
            guild = message.channel.guild
            try:
                owner_id = channel_get(message.channel.id,'owner')
            except:
                return[Mailbox().respond('Sorry, but it doesn\'t look like you\'re in a CC! If you are, please alert a Game Master as soon as possible.')]
            if owner_id != None:
                owner_object = guild.get_member(int(owner_id))
            embed = Embed(color=0x00cdcd, title='Conspiracy Channel Info')
            if owner_object != None and owner_id != None:
                embed.add_field(name='Channel Owner', value='<@' + owner_id + '>')
                embed.set_thumbnail(url=owner_object.avatar_url)
            elif owner_id == None:
                return [Mailbox().respond('Sorry, but it doesn\'t look like you\'re in a CC! If you are, please alert a Game Master as soon as possible.')]
            else:
                try:
                    owner_name = db_get(owner_id,'name')
                    if str(owner_name) == 'None':
                        owner_name = 'Sorry, an error was encountered. Please alert a Game Master.'
                except:
                    owner_name == 'Sorry, an error was encountered. Please alert a Game Master.'

                embed.add_field(name='Channel Owner', value=owner_name)

            embed.add_field(name='Channel Name', value=message.channel.name)
            embed.add_field(name='Participants', value='[Bob Roberts], [Dummy], [Randium], [BenTechy66], [Ed588]')
            embed.set_footer(text='Conspiracy Channel Information requested by ' + message.author.nick)
            return [Mailbox().embed(embed, message.channel.id)]
        if is_command(message,['info'],True):
            # TODO
            return todo()

        '''myrole'''
        # This command sends the user's role back to them in a DM.
        if is_command(message,['myrole']):
            return [Mailbox().dm("Your role is **{}**.".format(db_get(message.author.id,'role')), message.author.id,False,[db_get(message.author.id,'emoji')])]
        if is_command(message,['myrole'],True):
            # TODO
            return todo()

        '''remove'''
        # This command removes a given user from a conspiracy channel.
        # A user should not get removed if they're the channel owner.
        if is_command(message,['remove']):
            members_to_remove = check.users(message)
            if is_owner(user_id,channel_id) == False:
                return [Mailbox().respond("I\'m sorry, but you cannot use this command over here!")]
            command = Mailbox()
            for x in members_to_remove:
                if is_owner(x,channel_id) == True:
                    return [Mailbox().respond("The owner of a CC can\'t be removed! Please try again.")]
                command.edit_cc(x,channel_id,0)
            return [command.respond("Insert Randium's comment here")]

        if is_command(message,['remove'],True):
            # TODO
            return todo()

        # =======================================================
        #                ROLE SPECIFIC COMMANDS
        # =======================================================
        if personal_channel(user_id,message_channel) == True:

            '''give_amulet'''
            # This command can be executed by everyone, but only in one channel.
            # That's the amulet channel.
            # To be worked out how exactly.
            if is_command(message,['give_amulet']):
                # TODO
                return todo()
            if is_command(message,['give_amulet'],True):
                # TODO
                return todo()

            '''assassinate'''
            # Assassin's command; kill a victim
            if is_command(message,['assassinate','kill']) and user_role == "Assassin":
                # TODO
                return todo()
            if is_command(message,['assassinate','kill'],True) and user_role == "Assassin":
                # TODO
                return todo()

            '''aura'''
            # The command for aura tellers
            if is_command(message,['aura','tell','vision']) and user_role == "Aura Teller":
                # TODO
                return todo()
            if is_command(message,['aura','tell','vision'],True) and user_role == "Aura Teller":
                # TODO
                return todo()

            '''barber_kill'''
            # Barber kill - to assassinate a victim during the day
            if is_command(message,['assassinate','barber_kill','cut']) and user_role == "Barber":
                # TODO
                return todo()
            if is_command(message,['assassinate','barber_kill','cut'],True) and user_role == "Barber":
                # TODO
                return todo()

            '''seek'''
            # Crowd seeker's power
            if is_command(message,['crowd','seek']) and user_role == "Crowd Seeker":
                # TODO
                return todo()
            if is_command(message,['crowd','seek'],True) and user_role == "Crowd Seeker":
                # TODO
                return todo()

            '''kiss'''
            # Cupid's power to fall in love with someone.
            if is_command(message,['kiss','love','shoot']) and user_role == "Cupid":
                # TODO
                return todo()
            if is_command(message,['kiss','love','shoot'],True) and user_role == "Cupid":
                # TODO
                return todo()

            '''follow'''
            # The command that allows the dog to choose a side.
            if is_command(message,['bark','become','choose','follow']) and user_role == "Dog":
                # TODO
                return todo()
            if is_command(message,['bark','become','choose','follow'],True) and user_role == "Dog":
                # TODO
                return todo()

            '''execute'''
            # This command allows the executioner to choose a replacement target.
            if is_command(message,['choose','execute']) and user_role == "Executioner":
                # TODO
                return todo()
            if is_command(message,['choose','execute'],True) and user_role == "Executioner":
                # TODO
                return todo()

            '''undoom'''
            # The Exorcist's command.
            if is_command(message,['exercise','exorcise','undoom']) and user_role == "Exorcist":
                # TODO
                return todo()
            if is_command(message,['exercise','exorcise','undoom'],True) and user_role == "Exorcist":
                # TODO
                return todo()

            '''inspect'''
            # The fortune teller's command.
            if is_command(message,['forsee','inspect','see','tell']) and user_role == "Fortune Teller":
                # TODO
                return todo()
            if is_command(message,['forsee','inspect','see','tell'],True) and user_role == "Fortune Teller":
                # TODO
                return todo()

            '''silence'''
            # Grandma's command.
            if is_command(message,['knit','knot','silence']) and user_role == "Grandma":
                # TODO
                return todo()
            if is_command(message,['knit','knot','silence'],True) and user_role == "Grandma":
                # TODO
                return todo()

            '''hook'''
            # The hooker's command
            if is_command(message,['f**k','hook','sleep']) and user_role == "Hooker":
                # TODO
                return todo()
            if is_command(message,['f**k','hook','sleep'],True) and user_role == "Hooker":
                # TODO
                return todo()

            '''hunt'''
            # The huntress' command. Used to keep track of whom will be shot.
            if is_command(message,['hunt','shoot']) and user_role == "Huntress":
                # TODO
                return todo()
            if is_command(message,['hunt','shoot'],True) and user_role == "Huntress":
                # TODO
                return todo()

            '''unfreeze'''
            # The innkeeper's command
            if is_command(message,['melt','unfreeze']) and user_role == "Innkeeper":
                # TODO
                return todo()
            if is_command(message,['melt','unfreeze'],True) and user_role == "Innkeeper":
                # TODO
                return todo()

            '''copy'''
            # The Look-Alike's command
            if is_command(message,['copy','imitate','mirror','resemble']) and user_role == "Look-Alike":
                # TODO
                return todo()
            if is_command(message,['copy','imitate','mirror','resemble'],True) and user_role == "Look-Alike":
                # TODO
                return todo()

            '''holify'''
            # The Priest's command
            if is_command(message,['holify','sacrify','water']) and user_role == "Priest":
                # TODO
                return todo()
            if is_command(message,['holify','sacrify','water'],True) and user_role == "Priest":
                # TODO
                return todo()

            '''purify'''
            # The Priestess' command
            if is_command(message,['heal','light','purify','sacrify']) and user_role == "Priestess":
                # TODO
                return todo()
            if is_command(message,['heal','light','purify','sacrify'],True) and user_role == "Priestess":
                # TODO
                return todo()

            '''threaten'''
            # The Raven's command
            if is_command(message,['threaten','raven']) and user_role == "Raven":
                # TODO
                return todo()
            if is_command(message,['threaten','raven'],True) and user_role == "Raven":
                # TODO
                return todo()

            '''reveal'''
            # The Royal Knight's command
            if is_command(message,['end','prevent','reveal','stop']) and user_role == "Royal Knight":
                # TODO
                return todo()
            if is_command(message,['end','prevent','reveal','stop'],True) and user_role == "Royal Knight":
                # TODO
                return todo()

            '''life'''
            # The witch' command to use her life potion
            if is_command(message,['heal','life','save']) and user_role == "Witch":
                # TODO
                return todo()
            if is_command(message,['heal','life','save'],True) and user_role == "Witch":
                # TODO
                return todo()

            '''death'''
            # The witch' command to use her death potion
            if is_command(message,['death','kill','murder','poison']) and user_role == "Witch":
                # TODO
                return todo()
            if is_command(message,['death','kill','murder','poison'],True) and user_role == "Witch":
                # TODO
                return todo()

            '''çurse'''
            # The curse caster's command
            if is_command(message,['cast','corrupt','curse']) and user_role == "Curse Caster":
                # TODO
                return todo()
            if is_command(message,['cast','corrupt','curse'],True) and user_role == "Curse Caster":
                # TODO
                return todo()

            '''infect'''
            # The infected wolf's command
            if is_command(message,['cough','infect','sneeze','turn']) and user_role == "Infected Wolf":
                # TODO
                return todo()
            if is_command(message,['cough','infect','sneeze','turn'],True) and user_role == "Infected Wolf":
                # TODO
                return todo()

            '''devour'''
            # The Lone wolf's command
            if is_command(message,['chew','devour','eat','kill','munch']) and user_role == "Lone Wolf":
                # TODO
                return todo()
            if is_command(message,['chew','devour','eat','kill','munch'],True) and user_role == "Lone Wolf":
                # TODO
                return todo()

            '''disguise'''
            # The tanner's command
            if is_command(message,['change','cloth','disguise','hide']) and user_role == "Tanner":
                # TODO
                return todo()
            if is_command(message,['change','cloth','disguise','hide'],True) and user_role == "Tanner":
                # TODO
                return todo()

            '''inspect'''
            # The Warlock's command
            if is_command(message,['forsee','inspect','see','tell']) and user_role == "Priestess":
                # TODO
                return todo()
            if is_command(message,['forsee','inspect','see','tell'],True) and user_role == "Priestess":
                # TODO
                return todo()

            '''devour'''
            # The white werewolf's command
            if is_command(message,['chew','devour','eat','kill','munch']) and user_role == "White Werewolf":
                # TODO
                return todo()
            if is_command(message,['chew','devour','eat','kill','munch'],True) and user_role == "White Werewolf":
                # TODO
                return todo()

            '''wager'''
            # The devil's command
            if is_command(message,['choose','wager']) and user_role == "Devil":
                # TODO
                return todo()
            if is_command(message,['choose','wager'],True) and user_role == "Devil":
                # TODO
                return todo()

            '''enchant'''
            # The flute player's command
            if is_command(message,['enchant','flute']) and user_role == "Flute Player":
                # TODO
                return todo()
            if is_command(message,['enchant','flute'],True) and user_role == "Flute Player":
                # TODO
                return todo()

            '''unite'''
            # The horseman's command
            if is_command(message,['apocalypse','clean','unite']) and user_role == "Horseman":
                # TODO
                return todo()
            if is_command(message,['apocalypse','clean','unite'],True) and user_role == "Horseman":
                # TODO
                return todo()

            '''guess'''
            # The ice king's command to add a guess about a user to their list.
            # Note that this command could/should be usable at any time, as long as the submit command isn't
            if is_command(message,['add','guess','freeze']) and user_role == "Ice King":
                # TODO
                return todo()
            if is_command(message,['add','guess','freeze'],True) and user_role == "Ice King":
                # TODO
                return todo()

            '''submit'''
            # The ice king's command to submit the list of people of whom they have guessed their roles.
            if is_command(message,['guess_that','freeze_all','submit']) and user_role == "Ice King":
                # TODO
                return todo()
            if is_command(message,['guess_that','freeze_all','submit'],True) and user_role == "Ice King":
                # TODO
                return todo()

            '''powder'''
            # Powder a player
            if is_command(message,['creeper','powder']) and user_role == "Pyromancer":
                # TODO
                return todo()
            if is_command(message,['creeper','powder'],True) and user_role == "Pyromancer":
                # TODO
                return todo()

            '''abduct'''
            # To kidnap players
            if is_command(message,['abduct','add','kidnap','swamp']) and user_role == "The Thing":
                # TODO
                return todo()
            if is_command(message,['abduct','add','kidnap','swamp'],True) and user_role == "The Thing":
                # TODO
                return todo()

            '''create_swamp'''
            # To create a new swamp with all victims
            if is_command(message,['abduct_all','create_swamp','start_cliche_horror_movie']) and user_role == "The Thing":
                # TODO
                return todo()
            if is_command(message,['abduct_all','create_swamp','start_cliche_horror_movie'],True) and user_role == "The Thing":
                # TODO
                return todo()

    # =============================================================
    #
    #                         EVERYONE
    #
    # =============================================================

    '''age'''
    # Allows users to set their age.
    if is_command(message,['age']):
        # TODO
        return todo()
    if is_command(message,['age'],True):
        # TODO
        return todo()

    '''profile'''
    # This command allows one to view their own profile
    # When giving another player's name, view that player's profile
    if is_command(message,['profile']):
        # TODO
        return todo()
    if is_command(message,['profile'],True):
        # TODO
        return todo()

    '''signup'''
    # This command signs up the player with their given emoji, assuming there is no game going on.
    if is_command(message,['signup']):
        emojis = check.emojis(message)
        choice_emoji = ""

        if emojis == False:
            msg = "**Incorrect syntax:** `" + prefix + "signup <emoji>`\n\nExample: `" + prefix + "signup :smirk:`"
            return [Mailbox().respond(msg,True)]

        for emoji in emojis:
            if emoji_to_player(emoji) == None:
                choice_emoji = emoji
                break

        if isParticipant(user_id,True,True):
            if choice_emoji == "":
               return [Mailbox().respond("You are already signed up with the {} emoji! Also, your emoji was occupied.".format(db_get(user_id,'emoji')),True)]
            db_set(user_id,'emoji',choice_emoji)
            reaction = Mailbox().respond("You have successfully changed your emoji to the {} emoji!".format(choice_emoji))
            return [reaction.spam("<@{}> has changed their emoji to the {} emoji.".format(user_id,choice_emoji))]

        if emoji == "":
            if len(choice_emojis) == 1:
                return [Mailbox().respond("I am sorry! Your chosen emoji was already occupied.",True)]
            return [Mailbox().respond("I am sorry, but all of your given emojis were already occupied! Such bad luck.",True)]
        signup(user_id,message.author.name,choice_emoji)
        reaction = Mailbox().respond("You have successfully signed up with the {} emoji!".format(choice_emoji))
        return [reaction.spam("<@{}> has signed up with the {} emoji.".format(user_id,choice_emoji))]
    # Help command
    if is_command(message,['signup'],True):
        msg = "**Usage:** `" + prefix + "signup <emoji>`\n\nExample: `" + prefix + "signup :smirk:`"
        return [Mailbox().respond(msg,True)]

    if message.content.startswith(prefix):
        return [Mailbox().respond("Sorry bud, couldn't find what you were looking for.",True)]

    return []