def quoteFilter(self, message: MessageChain):
     if not message.has(Quote):
         raise ExecutionStop()
     if plains := message.get(Plain):
         if all(text.__dict__['text'].strip() not in self.QUOTE_COMMANDS
                for text in plains):
             raise ExecutionStop()
 def atOrQuoteFilter(message: MessageChain):
     if not message.has(Quote) and not message.has(At):
         raise ExecutionStop()
     if plains := message.get(Plain):
         if any(text.__dict__['text'].strip() in
                PictureRipperListener.QUOTE_COMMANDS for text in plains):
             raise ExecutionStop()
 def judge(self, app: GraiaMiraiApplication, subject: T.Union[Group,
                                                              Friend],
           message: MessageChain) -> T.NoReturn:
     if isinstance(subject, Group):
         if (self.allow_group is not None) and (subject.id
                                                not in self.allow_group):
             raise ExecutionStop()
     elif isinstance(subject, Friend):
         if (self.allow_friend is not None) and (subject.id
                                                 not in self.allow_friend):
             raise ExecutionStop()
Exemple #4
0
def judge_depend_target(message: MessageChain):
    if not judge(message):
        raise ExecutionStop()
Exemple #5
0
 def cmdFilter(self, message: MessageChain):
     message: str = message.asDisplay()
     match = self.ripeReg(message)
     dis: [str] = message.split(' ')[0].upper()
     if dis[:3] not in self.APP_COMMANDS and not match:
         raise ExecutionStop()
Exemple #6
0
    def cmdFilter(self, message: MessageChain):
        message: str = message.asDisplay()
        match = self.ripeReg(message)
        dis: [str] = message.split(' ')[0].upper()
        if dis[:3] not in self.APP_COMMANDS and not match:
            raise ExecutionStop()

    def quoteFilter(self, message: MessageChain):
        if not message.has(Quote):
            raise ExecutionStop()
        if plains := message.get(Plain):
            if all(text.__dict__['text'].strip() not in self.QUOTE_COMMANDS for text in plains):
                raise ExecutionStop()
        else:
            raise ExecutionStop()

    @staticmethod
    def Permitted(message: GroupMessage):
        return message.sender.id in ymConfig.getConfig('setting').get('admins')

    def getRating(self, source, group, force=False):
        if group not in self.ratings.keys() or force:
            level = ymConfig.getConfig('setting').get('group_rate')[str(group)] if str(group) in ymConfig.getConfig(
                'setting').get('group_rate').keys() else ymConfig.getConfig('setting').get('rating')
            rs = {k: v for k, v in ymConfig.getConfig(source).get('rating').items() if v <= level}
            rating = sorted(rs.items(), key=lambda d: d[1], reverse=True)
            self.ratings[group] = rating[0][0]
            logger.info(f"rating {group} is {self.ratings[group]}")

    async def RipperHandler(self, app: Slave, message: GroupMessage, commands: list):
 def cmdFilter(self, message: MessageChain):
     if cmd := message.asDisplay().split(' '):
         cmd = cmd[0].upper()
         if not any(app_cmd in cmd for app_cmd in self.APP_COMMANDS):
             raise ExecutionStop()
Exemple #8
0
 def atOrQuoteFilter(message: MessageChain):
     if not message.has(Quote) and not message.has(At):
         raise ExecutionStop()
Exemple #9
0
 def quoteFilter(message: MessageChain):
     if not message.has(Quote):
         raise ExecutionStop()
Exemple #10
0
 def atFilter(message: MessageChain):
     if not message.has(At):
         raise ExecutionStop()
Exemple #11
0
 def cmdFilter(self, message: MessageChain):
     dis: str = message.asDisplay().split(' ')
     if dis[0].upper() not in self.APP_COMMANDS:
         raise ExecutionStop()
 def seTuTextFilter(self, message: MessageChain):
     message: str = message.asDisplay()
     match = self.ripeReg(message)
     if not match:
         raise ExecutionStop()