def receive_group_msg(ctx: GroupMsg): msg = ctx.Content num = re.findall("最新动态(.*?)条", msg) try: uid = msg.split()[1] except: send.text(ctx, "uid异常,请检查是否输入有误!") return if not num: num = 1 else: num = num[0] try: num = int(num) except: num_dict = { "一": "1", "二": "2", "两": "2", "三": "3", "四": "4", "五": "5", "六": "6", "七": "7", "八": "8", "九": "9", "十": "10" } num = int(num_dict.get(num)) if num > 12: send.text(ctx, "输入条数过多") return for i in range(num): try: recv = get_dyn(i, uid) if recv == "less": send.text(ctx, "没有更多动态了") cont = recv.split("***") upz = get_bili_name(uid) text = upz + "\n" + cont[0].split("@@@")[0] send.text(ctx, text) cont.pop(0) for pic in cont: sleep(1) pic = pic.split("@@@")[0] action.sendGroupPic(ctx.FromGroupId, picUrl=pic) sleep(1) except: send.text(ctx, "动态解析异常!")
def receive_group_msg(ctx: GroupMsg): try: uid = ctx.Content[5:] cont = get_bili_info(uid).split("!@#") if sys.platform == "win32": send.text(ctx, cont[0] + "\n头像:" + cont[1]) else: send.picture(ctx, cont[0], cont[1]) except: send.text(ctx, "查询异常,请检查uid是否正确!")
def receive_friend_msg(ctx: FriendMsg): send.text( ctx, "通用解析接口:\nhttp://video.mnsd.xyz/\n" "B站解析接口:\nhttps://bilibili.iiilab.com/")
def receive_group_msg(ctx: GroupMsg): send.text( ctx, "通用解析接口:\nhttp://video.mnsd.xyz/\n" "B站解析接口:\nhttps://bilibili.iiilab.com/", True)
def receive_group_msg(ctx: GroupMsg): if ctx.Content == "推送检测": push_status = bot_config.get_push_status() if push_status == 0: send.text(ctx, "程序已被终止,请联系管理员") else: qg_status = DbHelper.qg_status(ctx.FromGroupId) if qg_status == 0: send.text(ctx, "程序正在运行,但本群推送已关闭,发送”推送开启“以打开") else: send.text(ctx, "本群推送服务已开启,请等待接收...") elif ctx.Content[:4] == "推送新建": try: uid = int(ctx.Content[4:]) name = get_bili_name(uid) qg = ctx.FromGroupId DbHelper.creat(qg, uid, ctx.FromGroupName) send.text(ctx, "为up主 " + name + " 新建成功") except: send.text(ctx, "参数异常!添加方式:推送新建+uid") elif ctx.Content[:4] == "推送删除": # 获取到消息里面的uid,qg参数新建对象 uid = ctx.Content[4:] del_bili_push(uid, ctx.FromGroupId) elif ctx.Content[:4] == "推送列表": u_t_l = DbHelper.get_uid_time(ctx.FromGroupId) text = "已为以下up在本群开启推送服务:" for u_t in u_t_l: uid = u_t[0] text = text + "\n" + get_bili_name(uid) send.text(ctx, text) elif ctx.Content[:6] == "推送关闭本群": DbHelper.close_status(ctx.FromGroupId) send.text(ctx, "已关闭") elif ctx.Content[:6] == "推送开启本群": DbHelper.open_status(ctx.FromGroupId) send.text(ctx, "已开启") else: send.text(ctx, "bilibili动态推送服务\n=====================\n" "推送新建+uid => 在本群生成uid对应up的推送\n" "推送删除+uid => 删除本群中uid对应up的推送\n" "推送开启本群 => 打开本群推送服务\n" "推送关闭本群 => 关闭本群推送服务\n" "推送检测 => 查询目前推送状态\n" "推送列表 => 查询本群已添加推送的up")
def receive_friend_msg(ctx: FriendMsg): text = DbHelper.read() send.text(ctx, str(text))
def receive_friend_msg(ctx): send.text(ctx, SysInfo.all_info())
def receive_group_msg(ctx): send.text(ctx, SysInfo.all_info())