A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8 -*-
  2. """Generates help information."""
  3. actions, data = None, None
  4. def call(a, d):
  5. global actions, data
  6. actions, data = a, d
  7. if not data.args:
  8. do_general_help()
  9. else:
  10. do_command_help()
  11. def do_general_help():
  12. actions.say(data.chan, "\x02%s\x0F: I am a bot! You can get help for any command by typing '!help <command>'." % (data.nick))
  13. def do_command_help():
  14. command = data.args[0]
  15. try:
  16. exec "from irc.commands import %s as this_command" % command
  17. except ImportError:
  18. actions.say(data.chan, "\x02%s\x0F: command \x0303%s\x0301 not found!" % (data.nick, command))
  19. info = this_command.__doc__
  20. if info:
  21. actions.say(data.chan, "\x02%s\x0F: Info for command \x0303%s\x0301: %s" % (data.nick, command, info))
  22. else:
  23. actions.say(data.chan, "\x02%s\x0F: Sorry, no information for \x0303%s\x0301." % (data.nick, command))