Skip to content

Instantly share code, notes, and snippets.

@exallium
Created May 8, 2012 17:02
Show Gist options
  • Save exallium/2637341 to your computer and use it in GitHub Desktop.
Save exallium/2637341 to your computer and use it in GitHub Desktop.
Simple IRC bot using ircutils
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