Skip to content

Commit

Permalink
discord_client_idをハードコート
Browse files Browse the repository at this point in the history
  • Loading branch information
okaits committed Aug 11, 2024
1 parent 1fbed8b commit a686caa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion modules/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions modules/savedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a686caa

Please sign in to comment.