From a686caac21116fb2d4cda14f15a602b14520d554 Mon Sep 17 00:00:00 2001 From: okaits#7534 Date: Sun, 11 Aug 2024 17:06:31 +0900 Subject: [PATCH] =?UTF-8?q?discord=5Fclient=5Fid=E3=82=92=E3=83=8F?= =?UTF-8?q?=E3=83=BC=E3=83=89=E3=82=B3=E3=83=BC=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +-- modules/discord.py | 2 +- modules/savedata.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f4aaf55..41c5554 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,7 @@ Ubuntu 24.04のChromiumで動作確認をしています。 1. Discordを開く 2. `python3 -m poetry run python3 server.py` リポジトリにcdしてから、サーバーを起動します。 -3. (初回のみ) サーバーを起動した際にプロンプトが出てくるので、`1269728794944475166`と入力してEnterしてください。 -4. 動画を観る +3. 動画を観る ### License [MIT License](LICENSE.md) diff --git a/modules/discord.py b/modules/discord.py index 41b98d8..a202382 100644 --- a/modules/discord.py +++ b/modules/discord.py @@ -10,7 +10,7 @@ from . import savedata -presence_rpc = pypresence.Presence(savedata.discord_client_id) +presence_rpc = pypresence.Presence(savedata.DISCORD_CLIENT_ID) presence_rpc.connect() @functools.cache diff --git a/modules/savedata.py b/modules/savedata.py index 7068c58..b4e5170 100644 --- a/modules/savedata.py +++ b/modules/savedata.py @@ -10,13 +10,13 @@ if not SAVEDATA_FILE.exists(): with open(SAVEDATA_FILE, encoding="utf-8", mode="w") as h: - write_data = f'N2DSAVE: {int(input("Discord client id: "))}\n' + write_data = f'N2DSAVE\n' h.write(write_data) with open(SAVEDATA_FILE, encoding="utf-8", mode="r") as h: savedata = h.read() -discord_client_id = int(savedata.split("\n")[0][9:]) +DISCORD_CLIENT_ID = 1269728794944475166 now_playing: typing.Optional[tuple[str, datetime.datetime]] = None now_playing_time_update: typing.Optional[tuple[datetime.timedelta, datetime.datetime]] = None