From a8d3b596e49f94af1c3a8ccf845c000f8cc9a281 Mon Sep 17 00:00:00 2001 From: luyanci <2058282593@qq.com> Date: Sat, 8 Jun 2024 14:47:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=B8=8A=E8=88=B0=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=88=A4=E6=96=AD=20=E5=90=8C=E6=97=B6=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=B8=AAcommit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/content.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/content.py b/lib/content.py index cdafd9c..59c1b9a 100644 --- a/lib/content.py +++ b/lib/content.py @@ -26,8 +26,6 @@ def get_danmaku_on_gift(event:str): contented=content_name.replace(" {gift} ",f"{giftname}") except: print(contented) - - return contented def get_danmaku_on_wuser(event:str): @@ -38,18 +36,27 @@ def get_danmaku_on_wuser(event:str): content_name=contents.replace(" {user} ",f"{name}") except: print(content_name) - - return content_name def get_danmaku_on_buyguard(event:str): info = event['data'] print(info) - #giftname=info['gift_name'] + giftname=get_guard_type(int(info["guard_level"])) name= info['username'] try: - contents=str(main.config.roomcfg["chat"]["global"]["events"]['guard']) + contents=str(main.config.roomcfg["chat"]["global"]["events"]['gifts']) content_name=contents.replace(" {user} ",f"{name}") - #contented=content_name.replace(" {gift} ",f"{giftname}") + contented=content_name.replace(" {type} ",f"{giftname}") except: print(content_name) + print(contented) + return contented + +def get_guard_type(num:int): + if num == 1: + return "总督" + if num == 2: + return "提督" + if num == 3: + return "舰长" + \ No newline at end of file