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.

31 line
918 B

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