A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
962 B

  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 in ["voice", "devoice", "op", "deop"]:
  13. return True
  14. return False
  15. def process(self, data):
  16. if data.host not in 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))