Exemple #1
0
 def wrapper(gm: GroupMessage):
     cp = CommandParser(gm, settings.commandSymbol)
     gp = groupPermissions(cp.sender_id)
     if gp.isBlocked():
         raise ExecutionStop()
     if not re.match(pattern, cp.plain_message):
         raise ExecutionStop()
Exemple #2
0
 def wrapper(gm: GroupMessage):
     cp = CommandParser(gm, settings.commandSymbol)
     gp = groupPermissions(cp.sender_id)
     if gp.isBlocked():
         raise ExecutionStop()
     if cp.Command.cmd != command_name:
         raise ExecutionStop()
Exemple #3
0
 def remove() -> str:
     _l = str()
     for t in CP.at:
         targetGP = groupPermissions(t.target)
         _result = targetGP.unblockme()
         _message = f'{t.display} {tF.ban.remove_succ}\n' if _result else f'{t.display} {tF.ban.remove_fail}\n'
         _l = f'{_l}{_message}'
     return _l.strip('\n')
Exemple #4
0
 def add() -> str:
     _l = str()
     for t in CP.at:
         targetGP = groupPermissions(t.target)
         if not targetGP.isAdmin():
             _result = targetGP.blockme()
             _message = f'{t.display} {tF.ban.add_succ}\n' if _result else f'{t.display} {tF.ban.add_fail}\n'
             _l = f'{_l}{_message}'
     return _l.strip('\n')
Exemple #5
0
 def wrapper(gm: GroupMessage):
     cp = CommandParser(gm, settings.commandSymbol)
     gp = groupPermissions(cp.sender_id)
     if gp.isBlocked():
         raise ExecutionStop()
     inList = False
     for word in words_list:
       if word in cp.plain_message:
           inList = True
           break
     if not inList:
       raise ExecutionStop()
Exemple #6
0
async def membercardchangeevent_listener(app: GraiaMiraiApplication,
                                         event: MemberCardChangeEvent):
    member = event.member
    group = member.group
    GP = groupPermissions(member.id)  # 防止滥用
    if GP.isBlocked():
        return None
    if group.id in [
            settings.specialqq.littleskin_main,
            settings.specialqq.littleskin_cafe, settings.specialqq.csl_group
    ]:
        await app.sendGroupMessage(
            group, MessageChain.create([Plain(tF.constance_refresh_name)]))
Exemple #7
0
    def __init__(self, _groupmessage: GroupMessage, _command_symbol: str) -> None:
        '''初始化指令解析器

        Args:
            _groupmessage: `GroupMessage` 对象
            _command_symbol: 指令标识符'''
        self._commandSymbol = _command_symbol
        self.messagechain = _groupmessage.messageChain
        self.sender_id = _groupmessage.sender.id
        self.plain_message = self._getPlainMessage(self.messagechain)
        self.at = self._getAt()
        self.Command.cmd, self.Command.args, self.Command.argsList = self._getCommand()
        self.quote_plain_message = self._getQuotePlainMessage()
        self.permission = groupPermissions(self.sender_id)
def adminOnly(gm: GroupMessage):
    '''仅管理员'''
    cp = CommandParser(gm, settings.commandSymbol)
    gp = groupPermissions(cp.sender_id)
    if not gp.isAdmin():
        raise ExecutionStop()