예제 #1
0
async def GroupMessageHandler(group: Group, member: Member, msgchain: MessageChain):
    Record.addMessage(ChatRecord(messagechain=msgchain, group=group, member=member))
    if msgchain.has(Plain):
        text = msgchain.get(Plain)[0].text
        if text == '#词云生成':
            await app.sendGroupMessage(group, MessageChain.create(
                [At(member.id),
                 Plain('生成中...')]
            ))
            await app.sendGroupMessage(group, MessageChain.create(
                [At(member.id),
                 Image.fromLocalFile(wordCloudGenerator(Record.getAGroupMessageList(group.id)))]
            ))
        elif text == '#今日消息图表':
            await app.sendGroupMessage(group, MessageChain.create(
                [At(member.id),
                 Plain('生成中...')]
            ))
            await app.sendGroupMessage(group, MessageChain.create(
                [At(member.id),
                 Image.fromLocalFile(summaryGraphGenerator("today", Record.getAGroupMessageList(group.id)))]
            ))
        elif text == '#总消息图表':
            await app.sendGroupMessage(group, MessageChain.create(
                [At(member.id),
                 Plain('生成中...')]
            ))
            await app.sendGroupMessage(group, MessageChain.create(
                [At(member.id),
                 Image.fromLocalFile(summaryGraphGenerator("total", Record.getAGroupMessageList(group.id)))]
            ))
예제 #2
0
 def atOrQuoteFilter(message: MessageChain):
     if not message.has(Quote) and not message.has(At):
         raise ExecutionStop()
예제 #3
0
 def quoteFilter(message: MessageChain):
     if not message.has(Quote):
         raise ExecutionStop()
예제 #4
0
 def atFilter(message: MessageChain):
     if not message.has(At):
         raise ExecutionStop()