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.

33 lines
1.0 KiB

  1. # -*- coding: utf-8 -*-
  2. # Voice/devoice/op/deop users in the channel.
  3. from irc.base_command import BaseCommand
  4. from config.irc_config 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))