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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) if cmd.mentions_count == 0: response = "Vouch for whom?" return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) member = cmd.mentions[0] vouchee_data = EwUser(member = member) if vouchee_data.faction == user_data.faction: response = "{} has already joined your faction.".format(member.display_name) return await ewutils.send_message(cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message(cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))
async def enlist(cmd): user_data = EwUser(member=cmd.message.author) 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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) return await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) elif user_data.life_state == ewcfg.life_state_enlisted 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) elif user_data.faction == ewcfg.faction_rowdys: 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) elif user_data.life_state == ewcfg.life_state_enlisted 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response)) elif user_data.faction == ewcfg.faction_killers: 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 ewutils.send_message( cmd.client, cmd.message.channel, ewutils.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 user_data.persist() await ewrolemgr.updateRoles(client=cmd.client, member=cmd.message.author) else: response = "That's not a valid gang you can enlist in, bitch." # Send the response to the player. await ewutils.send_message( cmd.client, cmd.message.channel, ewutils.formatMessage(cmd.message.author, response))