Skip to content

Commit

Permalink
Merge pull request #49 from lenlino/post_weight
Browse files Browse the repository at this point in the history
キャラ定期登録
  • Loading branch information
lenlino authored May 23, 2024
2 parents c30cb38 + 1de1a5b commit f11ca61
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit f11ca61

Please sign in to comment.