A Python robot that edits Wikipedia and interacts with people over IRC https://en.wikipedia.org/wiki/User:EarwigBot
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

32 行
971 B

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