Merge pull request '更新 main.py' (#14) from ruler229-patch-7 into master

Reviewed-on: #14
This commit is contained in:
Ruler229 2025-05-21 21:50:31 +08:00
commit 9d59f9f1c3

25
main.py
View File

@ -37,7 +37,7 @@ class MyPlugin(Star):
conn.close() conn.close()
yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 你坚持了{time}s哦{a}.射出{V}ml,{b}!") yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 你坚持了{time}s哦{a}.射出{V}ml,{b}!")
@filter.command("我连打十次") @filter.command("我连打十次")
async def dajiaoX(self, event: AstrMessageEvent): async def dajiaoX(self, event: AstrMessageEvent):
if isUserExist(event.get_sender_id()) != True: if isUserExist(event.get_sender_id()) != True:
insertUser(event.get_sender_id()) insertUser(event.get_sender_id())
@ -50,23 +50,20 @@ class MyPlugin(Star):
,charset='utf8' # 字符编码 ,charset='utf8' # 字符编码
) )
#cur = conn.cursor() #cur = conn.cursor()
time = [] time = [];V = [];a = [];b = []
V = []
a = []
b = [1]
for i in range(0,10): for i in range(0,10):
time.append(round(random.uniform(1, 600), 2)) time.append(round(random.uniform(1, 600), 2))
V.append(round(random.uniform(0.01,100), 2)) V.append(round(random.uniform(0.01,100), 2))
a.append(time_long(time)) a.append(time_long(time[i]))
#b.append(volume(V)) b.append(volume(V[i]))
#sql = "INSERT INTO dajiao (openid, timelong, volume) VALUES (%s, %s, %s)" sql = "INSERT INTO dajiao (openid, timelong, volume) VALUES (%s, %s, %s)"
#values = (user_name,time[i],V[i]) values = (user_name,time[i],V[i])
#cur.execute(sql,values) cur.execute(sql,values)
#conn.commit() conn.commit()
#cur.close() cur.close()
#conn.close() conn.close()
yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 第一次你坚持了{time[0]}s哦,{a[0]}.射出{V[0]}ml,{b[0]}!\n第二次你坚持了{time[1]}s哦,{a[1]}.射出{V[1]}ml,{b[1]}!\n哎呀,一点也打不出来了!") yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 第一次你坚持了{time[0]}s哦,{a[0]}.射出{V[0]}ml,{b[0]}!\n第二次你坚持了{time[1]}s哦,{a[1]}.射出{V[1]}ml,{b[1]}!\n哎呀,一点也打不出来了!")
#yield event.plain_result(f"Hello,{get_user_name(event.get_sender_id())}, 第一次你坚持了{time[0]}s哦{a[0]}.射出{V[0]}ml,{b[0]}!\n一点也打不出来了!")
@filter.command("打打你的") @filter.command("打打你的")
async def dajiao_other(self, event: AstrMessageEvent, message: str): async def dajiao_other(self, event: AstrMessageEvent, message: str):