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)))] ))
def atOrQuoteFilter(message: MessageChain): if not message.has(Quote) and not message.has(At): raise ExecutionStop()
def quoteFilter(message: MessageChain): if not message.has(Quote): raise ExecutionStop()
def atFilter(message: MessageChain): if not message.has(At): raise ExecutionStop()