async def vouch(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler: response = "You lack the higher brain functions required to {}.".format( cmd.tokens[0]) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) response = "" if user_data.faction == "": response = "You have to join a faction before you can vouch for anyone." return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if cmd.mentions_count == 0: response = "Vouch for whom?" return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) member = cmd.mentions[0] vouchee_data = EwUser(member=member) if vouchee_data.poi != user_data.poi: response = "How do you pretend to vouch for that juvenile if you aren't with them, using a carrier pigeon? Go find them, dumbfuck!" return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if vouchee_data.faction == user_data.faction: response = "{} has already joined your faction.".format( member.display_name) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) vouchers = vouchee_data.get_vouchers() if user_data.faction in vouchers: response = "A member of your faction has already vouched for {}.".format( member.display_name) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) vouchee_data.vouch(faction=user_data.faction) response = "You place your undying trust in {}.".format( member.display_name) return await fe_utils.send_message( cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))
async def enlist(cmd): user_data = EwUser(member=cmd.message.author) if user_data.life_state == ewcfg.life_state_shambler: response = "You lack the higher brain functions required to {}.".format(cmd.tokens[0]) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) user_slimes = user_data.slimes time_now = int(time.time()) bans = user_data.get_bans() vouchers = user_data.get_vouchers() if user_data.life_state == ewcfg.life_state_corpse: response = "You're dead, bitch." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif ewutils.active_restrictions.get(user_data.id_user) != None and ewutils.active_restrictions.get(user_data.id_user) > 0: response = "You can't do that right now." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_slimes < ewcfg.slimes_toenlist: response = "You need to mine more slime to rise above your lowly station. ({}/{})".format(user_slimes, ewcfg.slimes_toenlist) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if cmd.tokens_count > 1: desired_faction = cmd.tokens[1].lower() else: response = "Which faction? Say '{} {}', '{} {}', or '{} {}'.".format(ewcfg.cmd_enlist, ewcfg.faction_killers, ewcfg.cmd_enlist, ewcfg.faction_rowdys, ewcfg.cmd_enlist, ewcfg.faction_slimecorp) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if desired_faction == ewcfg.faction_killers: if ewcfg.faction_killers in bans: response = "You are banned from enlisting in the {}.".format(ewcfg.faction_killers) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif ewcfg.faction_killers not in vouchers and user_data.faction != ewcfg.faction_killers: response = "You need a current gang member's permission to join the {}.".format(ewcfg.faction_killers) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.life_state in [ewcfg.life_state_enlisted, ewcfg.life_state_kingpin] and user_data.faction == ewcfg.faction_killers: response = "You are already enlisted in the {}! Look, your name is purple! Get a clue, idiot.".format(user_data.faction) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.faction == ewcfg.faction_rowdys or user_data.faction == ewcfg.faction_slimecorp: response = "Traitor! You can only {} in the {}, you treacherous cretin. Ask for a {} if you're that weak-willed.".format(ewcfg.cmd_enlist, user_data.faction, ewcfg.cmd_pardon) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # elif user_data.poi not in [ewcfg.poi_id_copkilltown]: # response = "How do you want to enlist in a gang's forces without even being in their headquarters? Get going to Cop Killtown, bitch." # return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: response = "Enlisting in the {}.".format(ewcfg.faction_killers) user_data.life_state = ewcfg.life_state_enlisted user_data.faction = ewcfg.faction_killers user_data.time_lastenlist = time_now + ewcfg.cd_enlist for faction in vouchers: user_data.unvouch(faction) user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) elif desired_faction == ewcfg.faction_rowdys: if ewcfg.faction_rowdys in bans: response = "You are banned from enlisting in the {}.".format(ewcfg.faction_rowdys) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) if ewcfg.faction_rowdys not in vouchers and user_data.faction != ewcfg.faction_rowdys: response = "You need a current gang member's permission to join the {}.".format(ewcfg.faction_rowdys) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.life_state in [ewcfg.life_state_enlisted, ewcfg.life_state_kingpin] and user_data.faction == ewcfg.faction_rowdys: response = "You are already enlisted in the {}! Look, your name is pink! Get a clue, idiot.".format(user_data.faction) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) elif user_data.faction == ewcfg.faction_killers or user_data.faction == ewcfg.faction_slimecorp: response = "Traitor! You can only {} in the {}, you treacherous cretin. Ask for a {} if you're that weak-willed.".format(ewcfg.cmd_enlist, user_data.faction, ewcfg.cmd_pardon) return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) # elif user_data.poi not in [ewcfg.poi_id_rowdyroughhouse]: # response = "How do you want to enlist in a gang's forces without even being in their headquarters? Get going to the Rowdy Roughhouse, bitch." # return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: response = "Enlisting in the {}.".format(ewcfg.faction_rowdys) user_data.life_state = ewcfg.life_state_enlisted user_data.faction = ewcfg.faction_rowdys user_data.time_lastenlist = time_now + ewcfg.cd_enlist for faction in vouchers: user_data.unvouch(faction) user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) elif desired_faction == ewcfg.faction_slimecorp: response = "Sorry, pal. That ship has sailed." return await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response)) else: response = "That's not a valid gang you can enlist in, bitch." # Send the response to the player. await fe_utils.send_message(cmd.client, cmd.message.channel, fe_utils.formatMessage(cmd.message.author, response))