A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

test.py 632 B

1234567891011121314151617181920212223242526
  1. # -*- coding: utf-8 -*-
  2. # A very simple command to test the bot.
  3. import random
  4. from irc.base_command import BaseCommand
  5. class Test(BaseCommand):
  6. def get_hook(self):
  7. return "msg"
  8. def get_help(self, command):
  9. return "Test the bot!"
  10. def check(self, data):
  11. if data.is_command and data.command == "test":
  12. return True
  13. return False
  14. def process(self, data):
  15. hey = random.randint(0, 1)
  16. if hey:
  17. self.connection.say(data.chan, "Hey \x02%s\x0F!" % data.nick)
  18. else:
  19. self.connection.say(data.chan, "'sup \x02%s\x0F?" % data.nick)