Created
December 14, 2012 21:44
-
-
Save brunobord/4288912 to your computer and use it in GitHub Desktop.
Django bot, used on #django-fr on Freenode. Very basic at the moment. Please be kind. Is using cmdbot: https://github.com/brunobord/cmdbot
This file contains 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
#-*- coding: utf8 -*- | |
import logging | |
from cmdbot.core import Bot, direct | |
from cmdbot.core import logger | |
from cmdbot.configs import ArgumentConfiguration | |
logger.setLevel(logging.DEBUG) | |
class Djangobot(Bot): | |
welcome_message = "Salut les djangosaures !" | |
config_class = ArgumentConfiguration | |
@direct | |
def do_beer(self, line): | |
"Sending a Beer Over IP" | |
_, _, nick = line._raw_message.partition(' ') | |
if not nick: | |
self.reply("http://beeroverip.org/random/", line=line) | |
else: | |
self.reply("http://beeroverip.org/random/", nick=nick) | |
do_beer.aliases = ('bière', 'soif') | |
@direct | |
def do_hs(self, line): | |
"Remind people not to make too much Off-Topic" | |
verb, sep, rest = line._raw_message.partition(' ') | |
self.me("slaps %s - Merci de ne pas abuser du hors-sujet ;o)" % ', '.join(rest.split())) | |
if __name__ == '__main__': | |
b = Djangobot() | |
b.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment