Created
May 8, 2012 17:02
-
-
Save exallium/2637341 to your computer and use it in GitHub Desktop.
Simple IRC bot using ircutils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ircutils import bot | |
from random import randint | |
# Nice to me | |
GOOD_PEOPLE = ['exallium'] | |
GOOD_RESPONSES = ['Yes, sir.', "At once.", | |
"Right away, sir", "Of course.", "Absolutely."] | |
# Rude to people who aren't me. | |
BAD_RESPONSES = ["No.", "I'm not your toy.", "F*** off.", | |
"What do I look like, your slave?!", "Hell naw."] | |
class ExalliumBot(bot.SimpleBot): | |
def on_channel_message(self, event): | |
message = event.message.split() | |
if message and message[0] == ".ex": | |
if event.source in GOOD_PEOPLE: | |
self.send_message(event.target, | |
GOOD_RESPONSES[randint(0, len(GOOD_RESPONSES) - 1)]) | |
else: | |
self.send_message(event.target, | |
BAD_RESPONSES[randint(0, len(BAD_RESPONSES) - 1)]) | |
if __name__ == "__main__": | |
exallium = ExalliumBot("exbot") | |
exallium.connect("irc.freenode.net", channel = ['#exallium']) | |
exallium.start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment