From 830617229da69548d5b34057c9ab5c8e117c6964 Mon Sep 17 00:00:00 2001 From: Saipo Date: Thu, 8 May 2025 19:30:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E6=89=93=E4=BD=A0?= =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/main.py b/main.py index 1595789..a555f4b 100644 --- a/main.py +++ b/main.py @@ -38,6 +38,40 @@ class MyPlugin(Star): yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 你坚持了{time}s哦,{a}.射出{V}ml,{b}!") + @filter.command("打打你的") + async def dajiao(self, event: AstrMessageEvent, message: str): + if isUserExist(event.get_sender_id()) != True: + insertUser(event.get_sender_id()) + + time = round(random.uniform(1, 600), 2) + V = round(random.uniform(0.01,100), 2) + a = time_long(time) + b = volume(V) + conn=pymysql.connect(host = '192.168.31.9' # 连接名称,默认127.0.0.1 + ,user = 'saipo' # 用户名 + ,passwd='Grasste0403' # 密码 + ,port= 3306 # 端口,默认为3306 + ,db='saipo' # 数据库名称 + ,charset='utf8' # 字符编码 + ) + sql = "SELECT openid FROM dajiaouser WHERE nameid = %s" + cur = conn.cursor() + cur.execute(sql, (message,)) + user_name_dajiao = cur.fetchall()[0][0] + if user_name_dajiao is None: + cur.close() + conn.close() + yield event.plain_result(f"没有找到这个人哦!") + + sql = "INSERT INTO dajiao (openid, timelong, volume) VALUES (%s, %s, %s)" + values = (user_name_dajiao,time,V) + cur.execute(sql,values) + conn.commit() + cur.close() + conn.close() + yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())},你帮助{get_user_name(user_name_dajiao)}进行了一次打胶, TA坚持了{time}s哦,{a}.射出{V}ml,{b}!") + + @filter.command("我的时长成就") async def timebeat(self, event: AstrMessageEvent):