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.

преди 13 години
12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. import random
  3. from classes import BaseCommand
  4. class Command(BaseCommand):
  5. """Praise people!"""
  6. name = "praise"
  7. def check(self, data):
  8. commands = ["praise", "earwig", "leonard", "leonard^bloom", "groove",
  9. "groovedog"]
  10. return data.is_command and data.command in commands
  11. def process(self, data):
  12. if data.command == "earwig":
  13. msg = "\x02Earwig\x0F is the bestest Python programmer ever!"
  14. elif data.command in ["leonard", "leonard^bloom"]:
  15. msg = "\x02Leonard^Bloom\x0F is the biggest slacker ever!"
  16. elif data.command in ["groove", "groovedog"]:
  17. msg = "\x02GrooveDog\x0F is the bestest heh evar!"
  18. else:
  19. if not data.args:
  20. msg = "You use this command to praise certain people. Who they are is a secret."
  21. else:
  22. msg = "You're doing it wrong."
  23. self.connection.reply(data, msg)
  24. return
  25. self.connection.say(data.chan, msg)