From 1de1a5b4535421a15a6c17f4d5afdb52cf6ee822 Mon Sep 17 00:00:00 2001 From: lenlino <65199014+lenlino@users.noreply.github.com> Date: Thu, 23 May 2024 18:13:42 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=AD=E3=83=A3=E3=83=A9=E5=AE=9A=E6=9C=9F?= =?UTF-8?q?=E7=99=BB=E9=8C=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/main.py b/main.py index 3066c7c..0b7fecd 100644 --- a/main.py +++ b/main.py @@ -37,22 +37,7 @@ async def init_bot(): os.system("git sparse-checkout set index_min") os.system("git checkout") - with open(f"{os.path.dirname(os.path.abspath(__file__))}/generate/StarRailRes/index_min/jp/characters.json", - encoding="utf-8") as f: - chara_json = json.load(f) - characters.clear() - for key, value in chara_json.items(): - name = value["name"] - if key == "8001": - name = "主人公・壊滅・物理" - elif key == "8003": - name = "主人公・存護・炎" - elif key == "8005": - name = "主人公・調和・虚数" - elif int(key) > 8000: - continue - characters.append(discord.OptionChoice(name=name, value=key)) - characters_name[key] = name + @bot.event @@ -71,6 +56,23 @@ async def status_update_task(): @tasks.loop(hours=24) async def regi_weight_task(): + with open(f"{os.path.dirname(os.path.abspath(__file__))}/generate/StarRailRes/index_min/jp/characters.json", + encoding="utf-8") as f: + chara_json = json.load(f) + characters.clear() + for key, value in chara_json.items(): + name = value["name"] + if key == "8001": + name = "主人公・壊滅・物理" + elif key == "8003": + name = "主人公・存護・炎" + elif key == "8005": + name = "主人公・調和・虚数" + elif int(key) > 8000: + continue + + characters.append(discord.OptionChoice(name=name, value=key)) + characters_name[key] = name channel = bot.get_channel(1242779790914752592) async for mes in channel.history(before=(datetime.datetime.now() + datetime.timedelta(days=-3))): if len(mes.attachments) == 0: