def shoot_func(nick, match, target, param=None): suspect = mb.data['interview']['suspect'] fate = mb.data['interview']['fate'] detective = mb.data['interview']['detective'] suspect_realname = mb.data['interview'][suspect] dick_realname = mb.data['interview'][detective] if match.group('shoot'): if nick == suspect: if fate == 'human': mb.tell( suspect + ': what the f**k is wrong with you, you\'re human, you\'re not even supposed to shoot at all.', target) mb.data['interview_stats'][suspect_realname]['as replicant'][ 'losses'] += 1 else: mb.tell( suspect + ': you killed the detective, no one wins. f*****g robots', target) else: if fate == 'human': mb.tell( detective + ': good job fucko you just KILLED a human BEING', target) mb.data['interview_stats'][dick_realname]['as detective'][ 'losses'] += 1 else: mb.tell(detective + ': nice shooting bruh one less robot scum', target) mb.data['interview_stats'][dick_realname]['as detective'][ 'wins'] += 1 mb.data['interview_stats'][suspect_realname]['as replicant'][ 'losses'] += 1 else: if nick == suspect: return if fate == 'human': mb.tell(detective + ': good jerb', target) mb.data['interview_stats'][dick_realname]['as detective'][ 'wins'] += 1 mb.data['interview_stats'][suspect_realname]['as replicant'][ 'losses'] += 1 else: mb.tell(detective + ': haha loser, that was a robot. get REKT', target) mb.data['interview_stats'][dick_realname]['as detective'][ 'losses'] += 1 mb.data['interview_stats'][suspect_realname]['as replicant'][ 'wins'] += 1 mb.data['interview'] = {'players': []} mb.save('interview') mb.save('interview_stats') del mb.responses['interview_shoot'] del mb.responses['interview_next']
def type_in_func(nick,match,target): options=re.split(separation,match.group('options')) options=[option.upper() for option in options] no=match.group("no") if "CAPS" in options: if no: mb.data['options']['caps']=False else: mb.data['options']['caps']=True if "NORMALLY" in options: mb.data['options']['quirk']=[] mb.data['options']['caps']=False mb.data['options']['color']="" else: quirks=[mb.format[option] for option in options if option in mb.format] if no: mb.data['options']['quirk']=list(set(mb.data['options']['quirk'])-set(quirks)) else: mb.data['options']['quirk'].extend(quirks) mb.data['options']['quirk']=list(set(mb.data['options']['quirk'])) for index,color in enumerate(mb.colors): if color in options: mb.data['options']['color']=chr(0x03)+str(index) break mb.save('options') mb.tell(nick+": I'll try",target)
def purge_aliases_func(nick,match,target): name=match.group('name') if not name in mb.data['aliases']: mb.tell(nick+": literally who",target) else: del mb.data['aliases'][name] mb.save('aliases') mb.tell(nick+": bam, done",target)
def on_start_func(nick,match,target): channel="#"+match.group('channel') if match.group('no'): mb.data['options']['to join']=list(set(mb.data['options']['to join'])-set([channel])) else: mb.data['options']['to join'].append(channel) mb.data['options']['to join']=list(set(mb.data['options']['to join'])) mb.save('options') mb.tell(nick+": ok",target)
def add_quote_func(nick,match,target): text=match.group('quote') date=datetime.date.today().isoformat() quote={'quote':text,'added by':nick,'date':date} mb.data['quotes'].append(quote) mb.save('quotes') mb.tell(nick+': added.',target) return
def add_quote_func(nick, match, target): text = match.group('quote') date = datetime.date.today().isoformat() quote = {'quote': text, 'added by': nick, 'date': date} mb.data['quotes'].append(quote) mb.save('quotes') mb.tell(nick + ': added.', target) return
def add_uncle_func(nick,match,target): names=re.split(separation,match.group('names')) if match.group('not'): mb.data['uncles']=list(set(mb.data['uncles'])-set(names)) mb.tell(nick+": well thank f**k", target) else: mb.data['uncles']=list(set(mb.data['uncles']) | set(names)) mb.tell(nick+": I mean ew but ok", target) mb.save('uncles')
def last_message_func(nick,match,target): date = datetime.now() when=shared.time_dict(date) message = match.group(0) if not nick in mb.data['logs']: mb.data['logs'][nick]={} mb.data['logs'][nick]['message'] = message mb.data['logs'][nick]['date'] = when mb.save('logs')
def last_message_func(nick, match, target): date = datetime.now() when = shared.time_dict(date) message = match.group(0) if not nick in mb.data['logs']: mb.data['logs'][nick] = {} mb.data['logs'][nick]['message'] = message mb.data['logs'][nick]['date'] = when mb.save('logs')
def next_func(nick,match,target,param=None): if len(mb.data['interview']['questions'])>2: mb.tell(nick+": you only get three questions pal, now make up your mind",target) return detective=mb.data['interview']['detective'] while True: question=choice(mb.data["interview_questions"]) if question not in mb.data['interview']['questions']: break mb.data['interview']['questions'].append(question) mb.save('interview') mb.tell("Here's another one:", detective) mb.tell(question, detective)
def next_func(nick, match, target, param=None): if len(mb.data['interview']['questions']) > 2: mb.tell( nick + ": you only get three questions pal, now make up your mind", target) return detective = mb.data['interview']['detective'] while True: question = choice(mb.data["interview_questions"]) if question not in mb.data['interview']['questions']: break mb.data['interview']['questions'].append(question) mb.save('interview') mb.tell("Here's another one:", detective) mb.tell(question, detective)
def quiz_answer(nick,match,target,param): who=None if nick in mb.data['quiz_stats']: who=nick for player in mb.data['aliases']: if nick in mb.data['aliases'][player]: who=player break if who: mb.data['quiz_stats'][who]['answers']+=1 else: mb.data['quiz_stats'][nick]={'answers':1} del mb.responses['quiz'] mb.tell(nick+": correct! good job nerd.",target) mb.save('quiz_stats') return
def deliver_message_func(nick, match, target): if nick not in mb.data['logs']: return if "messages" in mb.data['logs'][nick]: for message in mb.data['logs'][nick]['messages']: date = datetime.now() now = shared.time_dict(date) when = message['date'] time = shared.time_diff(now, when) mb.tell(message['nick'] + " said " + time + ": " + message['text'], nick) mb.data['logs'][nick]['messages'] = [] mb.save('logs') return
def shoot_func(nick,match,target,param=None): suspect=mb.data['interview']['suspect'] fate=mb.data['interview']['fate'] detective=mb.data['interview']['detective'] suspect_realname=mb.data['interview'][suspect] dick_realname=mb.data['interview'][detective] if match.group('shoot'): if nick==suspect: if fate=='human': mb.tell(suspect+ ': what the f**k is wrong with you, you\'re human, you\'re not even supposed to shoot at all.',target) mb.data['interview_stats'][suspect_realname]['as replicant']['losses']+=1 else: mb.tell(suspect+': you killed the detective, no one wins. f*****g robots',target) else: if fate=='human': mb.tell(detective+': good job fucko you just KILLED a human BEING',target) mb.data['interview_stats'][dick_realname]['as detective']['losses']+=1 else: mb.tell(detective+ ': nice shooting bruh one less robot scum',target) mb.data['interview_stats'][dick_realname]['as detective']['wins']+=1 mb.data['interview_stats'][suspect_realname]['as replicant']['losses']+=1 else: if nick==suspect: return if fate=='human': mb.tell(detective+': good jerb',target) mb.data['interview_stats'][dick_realname]['as detective']['wins']+=1 mb.data['interview_stats'][suspect_realname]['as replicant']['losses']+=1 else: mb.tell(detective+ ': haha loser, that was a robot. get REKT',target) mb.data['interview_stats'][dick_realname]['as detective']['losses']+=1; mb.data['interview_stats'][suspect_realname]['as replicant']['wins']+=1; mb.data['interview']={'players':[]} mb.save('interview') mb.save('interview_stats') del mb.responses['interview_shoot'] del mb.responses['interview_next']
def send_message_func(nick,match,target): who = match.group('who') date = datetime.now() when=shared.time_dict(date) message = match.group('what') if not who in mb.data['logs']: mb.data['logs'][who]={} if not 'messages' in mb.data['logs'][who]: mb.data['logs'][who]['messages']=[] mb.data['logs'][who]['messages'].append({'text':message, 'nick': nick,'date':when}) mb.tell(nick+": jeez FINE I'll tell em",target) mb.save('logs')
def deliver_message_func(nick,match,target): if nick not in mb.data['logs']: return if "messages" in mb.data['logs'][nick]: for message in mb.data['logs'][nick]['messages']: date = datetime.now() now=shared.time_dict(date) when = message['date'] time = shared.time_diff(now,when) mb.tell(message['nick']+" said "+time+": "+message['text'],nick) mb.data['logs'][nick]['messages']=[] mb.save('logs') return
def add_aliases_func(nick,match,target): name=match.group('name') no=match.group('no') aliases=re.split(separation,match.group('aliases')) if no: if name in mb.data['aliases']: mb.data['aliases'][name]=list(set(mb.data['aliases'][name])-set(aliases)) else: mb.tell(nick+": who?...",target) return else: if name in mb.data['aliases']: mb.data['aliases'][name]=list(set(mb.data['aliases'][name])| set(aliases)) else: mb.data['aliases'][name]=aliases mb.save('aliases') mb.tell(nick+": alright done",target)
def send_message_func(nick, match, target): who = match.group('who') date = datetime.now() when = shared.time_dict(date) message = match.group('what') if not who in mb.data['logs']: mb.data['logs'][who] = {} if not 'messages' in mb.data['logs'][who]: mb.data['logs'][who]['messages'] = [] mb.data['logs'][who]['messages'].append({ 'text': message, 'nick': nick, 'date': when }) mb.tell(nick + ": jeez FINE I'll tell em", target) mb.save('logs')
def points_func(nick,match,target): do=match.group('do') who=None name=match.group('name') number=int(match.group('number')) if name in mb.data['quiz_stats']: who=name else: for player in mb.data['aliases']: if who in mb.data['aliases'][player] and player in mb.data['quiz_stats']: who=player if not who: mb.tell(nick+": what points you f**k",target) return if match.group('do').upper()=='GIVE': mb.data["quiz_stats"][who]["answers"]+=number else: mb.data["quiz_stats"][who]["answers"]-=number mb.save("quiz_stats") mb.tell(nick+": aight, done",target)
def save_func(nick,match,target): name=match.group('name').lower() thing=match.group('thing') mb.data['data'][name]=thing mb.tell(nick+": aight",target) mb.save('data')
def interview_func(nick, match, target): mb.load("interview_questions") who = nick role = match.group("role") for player in mb.data['aliases']: if nick in mb.data['aliases'][player]: who = player break if role: if role in mb.data['interview'].keys(): name = mb.data['interview'][role] mb.tell( nick + ": " + name + " called dibs on being a " + role + ". get rekt nerd", target) return else: mb.data['interview'][role] = who if not who in mb.data['interview_stats']: mb.data['interview_stats'][who] = { "as detective": { "wins": 0, "losses": 0 }, "as replicant": { "wins": 0, "losses": 0 } } mb.save('interview_stats') if len(mb.data['interview']['players']) == 2: mb.tell("wait until the current game ends you poopsquirrel", target) return else: mb.data['interview']['players'].append(nick) mb.data['interview'][nick] = who if len(mb.data['interview']['players']) == 1: mb.tell("Game started, waiting for another player to join.", target) else: if "detective" in mb.data['interview']: if mb.data['interview']['detective'] == mb.data['interview'][ 'players'][0]: mb.data['interview']['suspect'] = mb.data['interview'][ 'players'][1] else: mb.data['interview']['suspect'] = mb.data['interview'][ 'players'][0] elif "suspect" in mb.data['interview']: if mb.data['interview']['suspect'] == mb.data['interview'][ 'players'][0]: mb.data['interview']['detective'] = mb.data['interview'][ 'players'][1] else: mb.data['interview']['detective'] = mb.data['interview'][ 'players'][0] else: shuffle(mb.data['interview']['players']) mb.data['interview']['suspect'] = mb.data['interview'][ 'players'][0] mb.data['interview']['detective'] = mb.data['interview'][ 'players'][1] fate = choice(['human', 'replicant']) if fate == 'human': answer = "SPEAK TRULY" else: answer = "LIE" mb.data['interview']['fate'] = fate suspect = mb.data['interview']['suspect'] detective = mb.data['interview']['detective'] question = choice(mb.data["interview_questions"]) mb.data['interview']['questions'] = [question] mb.tell( detective + " is the detective, " + suspect + " is the suspect", target) mb.tell( "You're a " + fate + " bruh, that means you are REQUIRED TO " + answer + " answerin' " + detective + "'s questions.", suspect) mb.tell( "You're the detective. Ask this question miss marple, you can paraphrase it:", detective) mb.tell(question, detective) interview_responses(target) mb.save('interview')
def reset_func(nick,match,target): mb.tell(nick+": fun cancelled, gotcha",target) mb.data['interview']={'players':[]} mb.save('interview')
def picture_func(nick,match,target): mb.data["stuff"]["last_picture"]=match.group("link") print("saved picture link") mb.save("stuff") print("saved data['stuff']")
def reset_func(nick, match, target): mb.tell(nick + ": fun cancelled, gotcha", target) mb.data['interview'] = {'players': []} mb.save('interview')
def picture_func(nick, match, target): mb.data["stuff"]["last_picture"] = match.group("link") print("saved picture link") mb.save("stuff") print("saved data['stuff']")
def save_func(nick, match, target): name = match.group('name').lower() thing = match.group('thing') mb.data['data'][name] = thing mb.tell(nick + ": aight", target) mb.save('data')
def interview_func(nick,match,target): mb.load("interview_questions") who=nick role=match.group("role") for player in mb.data['aliases']: if nick in mb.data['aliases'][player]: who=player break if role: if role in mb.data['interview'].keys(): name = mb.data['interview'][role] mb.tell(nick+": "+name+" called dibs on being a "+role+". get rekt nerd",target) return; else: mb.data['interview'][role]=who if not who in mb.data['interview_stats']: mb.data['interview_stats'][who]={"as detective":{"wins":0,"losses":0},"as replicant":{"wins":0,"losses":0}} mb.save('interview_stats') if len(mb.data['interview']['players'])==2: mb.tell("wait until the current game ends you poopsquirrel",target) return else: mb.data['interview']['players'].append(nick) mb.data['interview'][nick]=who if len(mb.data['interview']['players'])==1: mb.tell("Game started, waiting for another player to join.",target) else: if "detective" in mb.data['interview']: if mb.data['interview']['detective'] == mb.data['interview']['players'][0]: mb.data['interview']['suspect']=mb.data['interview']['players'][1] else: mb.data['interview']['suspect']=mb.data['interview']['players'][0] elif "suspect" in mb.data['interview']: if mb.data['interview']['suspect'] == mb.data['interview']['players'][0]: mb.data['interview']['detective']=mb.data['interview']['players'][1] else: mb.data['interview']['detective']=mb.data['interview']['players'][0] else: shuffle(mb.data['interview']['players']) mb.data['interview']['suspect']=mb.data['interview']['players'][0] mb.data['interview']['detective']=mb.data['interview']['players'][1] fate=choice(['human','replicant']) if fate=='human': answer="SPEAK TRULY" else: answer="LIE" mb.data['interview']['fate'] = fate suspect = mb.data['interview']['suspect'] detective = mb.data['interview']['detective'] question=choice(mb.data["interview_questions"]) mb.data['interview']['questions']=[question] mb.tell(detective+" is the detective, "+suspect+" is the suspect",target) mb.tell("You're a "+fate+" bruh, that means you are REQUIRED TO "+answer+" answerin' "+detective+"'s questions.",suspect) mb.tell("You're the detective. Ask this question miss marple, you can paraphrase it:", detective) mb.tell(question,detective) interview_responses(target) mb.save('interview')