def receive_group_msg(ctx: GroupMsg):
    content = ctx.Content.replace('转卡片', '').strip()
    action = Action(ctx.CurrentQQ)
    try:
        json_text = json.dumps(json.loads(content))
        action.send_group_json_msg(ctx.FromGroupId, content=json_text)
    except Exception:
        action.send_group_xml_msg(ctx.FromGroupId, content=content)
Beispiel #2
0
def receive_group_msg(ctx: GroupMsg):
    if ctx.FromUserId != configuration.qq:

        action = Action(configuration.qq)
        if ctx.MsgType == 'TextMsg':
            command = ctx.Content.split(' ')
            if command[0] == "点歌":

                # check
                plugin = PluginControl()
                if not plugin.check("点歌", ctx.FromUserId, ctx.FromGroupId):
                    return

                if len(command) == 2:
                    content = xml_get_qq(command[1])
                    print(content)
                    action.send_group_xml_msg(ctx.FromGroupId, content)
                if len(command) == 3:
                    content = xml_get_qq(command[1], int(command[2]))
                    print(content)
                    action.send_group_xml_msg(ctx.FromGroupId, content)