def bot_run(): channel = get_channel() server = get_server() nickname = "THANOS" irc = IRC() irc.connect(server, channel, nickname) # Infinite loop until disconnected while True: text = filter_input(irc.get_text(), nums=True) print text if check_msg(text, channel) and "imperfectly balanced" in text.lower(): irc.send(channel, "Let's fix that shall we... *snap*") elif check_msg(text, channel) and "perfectly balanced" in text.lower(): irc.send(channel, "As all things should be") if check_msg(text, channel) and "imperfectly balanced"[::-1]\ in text.lower(): irc.send(channel, "Let's fix that shall we... *snap*") elif check_msg(text, channel) and "perfectly balanced"[::-1]\ in text.lower(): irc.send(channel, "As all things should be"[::-1]) if check_msg(text, channel) and "fun" in text.lower(): irc.send( channel, "Fun isn't something one considers when balancing the universe" ) if check_msg(text, channel) and "you should have gone for the head"\ in text.lower(): irc.send(channel, "*snap*")
def bot_run(): channel = get_channel() server = get_server() nickname = "spider_bot" irc = IRC() irc.connect(server, channel, nickname) # Infinite loop until disconnected while True: text = filter_input(irc.get_text()) print text if check_msg(text, channel) and "*snap*" in text.lower(): irc.send(channel, "Alexis...I don't feel so good...") irc.quit("disintegrated") if nickname == "spider_bot": nickname = "CAPTAIN_MARVEL" elif nickname == "CAPTAIN_MARVEL": nickname = "spider_bot" sleep(5) # Because quitting closes the connection with the server irc = IRC() irc.connect(server, channel, nickname) if check_msg(text, channel) and "goat" in text.lower(): with open("./static/battle_goat.txt", "r") as goat: lines = goat.readlines() for line in lines: irc.send(channel, line.strip("""\n""")) if check_msg(text, channel) and "pineapple" in text.lower(): with open("./static/pineapple.txt", "r") as pineapple: lines = pineapple.readlines() for line in lines: irc.send(channel, line.strip("""\n""")) if check_msg(text, channel)\ and ("tom brady" in text.lower() or "tb12" in text.lower() or "touchdown tommy" in text.lower()): irc.send(channel, "the GOAT") if check_msg(text, channel) and "spider_bot" in text.lower(): irc.send(channel, ":D") if check_msg(text, channel) and "the herd" in text.lower(): irc.send(channel, "ALL THE GOATS") if check_msg(text, channel) and "idea" in text.lower(): irc.send(channel, "it's gonna be YUUUGGEEE") if "QUIT" in text: irc.send(channel, "*mic drop*")
def bot_run(): channel = get_channel() server = get_server() nickname = "test_bot" irc = IRC() irc.connect(server, channel, nickname) while True: text = filter_input(irc.get_text()) print text if check_msg(text, channel) and "test" in text.lower(): irc.send(channel, "Test successful!")
def emoji_bot(): channel = get_channel() server = get_server() nickname = "emoji_bot" irc = IRC() irc.connect(server, channel, nickname) # Implicitly render Emojibot help on every successful connection attempt emoji_bot_help(irc, channel) # Infinite loop until disconnected while True: text = filter_input(irc.get_text()) print text # Retrieve Emojibot help whenever "emoji_bot --help" is called if check_msg(text, channel) and "emoji_bot --help" in text.lower(): emoji_bot_help(irc, channel) # -------------------- Various emojis implemented --------------------- if check_msg(text, channel) and "*smiles*" in text.lower(): irc.send( channel, emoji.emojize(':smiley:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*winks*" in text.lower(): irc.send( channel, emoji.emojize(':wink:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*laughs*" in text.lower(): irc.send( channel, emoji.emojize(':joy:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*fistbombs*" in text.lower(): irc.send( channel, emoji.emojize(':punch:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*heart*" in text.lower(): irc.send( channel, emoji.emojize(':hearts:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*smirks*" in text.lower(): irc.send( channel, emoji.emojize(':smirk:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*sleeps*" in text.lower(): irc.send( channel, emoji.emojize(':zzz:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*cool*" in text.lower(): irc.send( channel, emoji.emojize(':sunglasses:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*cries*" in text.lower(): irc.send( channel, emoji.emojize(':cry:', use_aliases=True).encode("utf-8", "replace")) if check_msg(text, channel) and "*tongue*" in text.lower(): irc.send( channel, emoji.emojize(':stuck_out_tongue:', use_aliases=True).encode("utf-8", "replace")) # Secret mic_drop emoji not included in the emoji_bot_help if check_msg(text, channel) and "*mic drop*" in text.lower(): irc.send( channel, emoji.emojize(':microphone:', use_aliases=True).encode("utf-8", "replace"))