def admin_test(flag, content, fromId): content = content.lstrip('.') if content == 'test': if flag == 1: action = Action(configuration.qq) action.send_group_pic_msg(fromId, 'https://t.cn/A6Am7xYO') elif flag == 2: action = Action(configuration.qq) action.send_friend_pic_msg(fromId, 'https://t.cn/A6Am7xYO') else: return 'https://t.cn/A6Am7xYO'
def receive_friend_msg(ctx: FriendMsg): if ctx.Content.startswith('ph '): args = [i.strip() for i in ctx.Content.split(' ') if i.strip()] if len(args) >= 3: left = args[1] right = args[2] f = combine_img_horizontal if len(args) >= 4: if args[3] == '1': f = combine_img_vertical bot = Action(qq_or_bot=ctx.CurrentQQ, queue=True, queue_delay=0.5) bot.send_friend_pic_msg( ctx.FromUin, picBase64Buf=f(left, right), )
def receive_friend_msg(ctx: FriendMsg): action = Action(configuration.qq) if ctx.MsgType == 'TextMsg': command = ctx.Content.split(' ', 1) print(command) if command[0] == "latex" and len(command) > 1: latex_content = command[1] url = 'https://quicklatex.com/latex3.f' data = {"formula": transfer_spacing(latex_content), "fcolor": "000000", "fsize": "70px", "mode": "0", "out": "1", "remhost": "quicklatex.com"} response = post(url, data) content = response.text.split("\r\n") if content[0] == "0": pic_url = content[1].split(' ')[0] print(pic_url) action.send_friend_pic_msg(ctx.FromUin, picUrl=pic_url, timeout=20) else: action.send_friend_text_msg(ctx.FromUin, "无法识别公式!")
def receive_friend_msg(ctx: FriendMsg): setu_allow = False if ctx.FromUin != configuration.qq: action = Action(configuration.qq) if ctx.MsgType == 'TextMsg': command = ctx.Content.split(' ') if command[0] == "setu": if setu_allow: if len(command) == 2: execute = command[1] else: execute = "drawings" id_url = "http://jinfans.top/setu/latest/view/random?type=" + execute id_image = get_html_text(id_url) id_json = json.loads(id_image) url = "http://jinfans.top/setu/latest/view/direct/" + id_json["_id"] action.send_friend_pic_msg(ctx.FromUin, content=execute, picUrl=url) else: action.send_friend_text_msg(ctx.FromUin, content='ф╜ахЬицГ│ЁЯНС')