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.

chanops.py 985 B

13 years ago
12345678910111213141516171819202122232425262728293031
  1. # -*- coding: utf-8 -*-
  2. # Voice/devoice/op/deop users in the channel.
  3. from irc.classes import BaseCommand
  4. from core import config
  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 in ["voice", "devoice", "op", "deop"]:
  13. return True
  14. return False
  15. def process(self, data):
  16. if data.host not in config.irc["permissions"]["admins"]:
  17. self.connection.reply(data, "you must be a bot admin to use this command.")
  18. return
  19. if not data.args: # if it is just !op/!devoice/whatever without arguments, assume they want to do this to themselves
  20. target = data.nick
  21. else:
  22. target = data.args[0]
  23. self.connection.say("ChanServ", "%s %s %s" % (data.command, data.chan, target))