A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

chanops.py 1.0 KiB

1234567891011121314151617181920212223242526272829303132
  1. # -*- coding: utf-8 -*-
  2. # Voice/devoice/op/deop users in the channel.
  3. from irc.base_command import BaseCommand
  4. from config.irc import *
  5. class ChanOps(BaseCommand):
  6. def get_hooks(self):
  7. return ["msg"]
  8. def get_help(self, command):
  9. action = command.capitalize()
  10. return "%s users in the channel." % action
  11. def check(self, data):
  12. if data.is_command and (data.command == "voice" or data.command == "devoice"
  13. or data.command == "op" or data.command == "deop"):
  14. return True
  15. return False
  16. def process(self, data):
  17. if data.host not in ADMINS:
  18. self.connection.reply(data, "you must be a bot admin to use this command.")
  19. return
  20. if not data.args: # if it is just !op/!devoice/whatever without arguments, assume they want to do this to themselves
  21. target = data.nick
  22. else:
  23. target = data.args[0]
  24. self.connection.say("ChanServ", "%s %s %s" % (data.command, data.chan, target))