コード例 #1
0
ファイル: Ignore.py プロジェクト: DotsTheHero/PyMoronBot
    def execute(self, message):
        """
        @type message: IRCMessage
        """
        if message.User.Name not in GlobalVars.admins:
            return IRCResponse(ResponseType.Say, 'Only my admins can edit the ignore list', message.ReplyTo)

        if len(message.ParameterList) > 0:
            for user in message.ParameterList:
                if user.lower() not in ignores.ignoreList:
                    ignores.ignoreList.append(user.lower())

            ignores.saveList()

            output = 'Now ignoring user(s) {0}'.format(', '.join(message.ParameterList))

            return IRCResponse(ResponseType.Say, output, message.ReplyTo)

        else:
            if ignores.ignoreList is not None and len(ignores.ignoreList) > 0:
                return IRCResponse(ResponseType.Say,
                                   'Ignored users: {0}'.format(', '.join(sorted(ignores.ignoreList))),
                                   message.ReplyTo)
            else:
                return IRCResponse(ResponseType.Say, 'Not currently ignoring anyone!', message.ReplyTo)
コード例 #2
0
ファイル: Ignore.py プロジェクト: LBbot/PyMoronBot
    def execute(self, message):
        """
        @type message: IRCMessage
        """
        if message.User.Name not in GlobalVars.admins:
            return IRCResponse(ResponseType.Say,
                               'Only my admins can edit the ignore list',
                               message.ReplyTo)

        if len(message.ParameterList) > 0:
            for user in message.ParameterList:
                if user.lower() not in ignores.ignoreList:
                    ignores.ignoreList.append(user.lower())

            ignores.saveList()

            output = 'Now ignoring user(s) {0}'.format(', '.join(
                message.ParameterList))

            return IRCResponse(ResponseType.Say, output, message.ReplyTo)

        else:
            if ignores.ignoreList is not None and len(ignores.ignoreList) > 0:
                return IRCResponse(
                    ResponseType.Say, 'Ignored users: {0}'.format(', '.join(
                        sorted(ignores.ignoreList))), message.ReplyTo)
            else:
                return IRCResponse(ResponseType.Say,
                                   'Not currently ignoring anyone!',
                                   message.ReplyTo)
コード例 #3
0
ファイル: Unignore.py プロジェクト: DotsTheHero/PyMoronBot
    def execute(self, message):
        """
        @type message: IRCMessage
        """
        if message.User.Name not in GlobalVars.admins:
            return IRCResponse(ResponseType.Say, 'Only my admins can edit the ignore list', message.ReplyTo)

        if len(message.ParameterList) > 0:
            for user in message.ParameterList:
                if user.lower() in ignores.ignoreList:
                    ignores.ignoreList.remove(user.lower())

            ignores.saveList()
                
            output = 'No longer ignoring user(s) {0}'.format(', '.join(message.ParameterList))

            return IRCResponse(ResponseType.Say, output, message.ReplyTo)

        else:
            return IRCResponse(ResponseType.Say, self.help, message.ReplyTo)
コード例 #4
0
    def execute(self, message):
        """
        @type message: IRCMessage
        """
        if message.User.Name not in GlobalVars.admins:
            return IRCResponse(ResponseType.Say,
                               'Only my admins can edit the ignore list',
                               message.ReplyTo)

        if len(message.ParameterList) > 0:
            for user in message.ParameterList:
                if user.lower() in ignores.ignoreList:
                    ignores.ignoreList.remove(user.lower())

            ignores.saveList()

            output = 'No longer ignoring user(s) {0}'.format(', '.join(
                message.ParameterList))

            return IRCResponse(ResponseType.Say, output, message.ReplyTo)

        else:
            return IRCResponse(ResponseType.Say, self.help, message.ReplyTo)