Skip to content

Commit 16dd96b

Browse files
authored
Merge pull request #4 from wjpattyn/main
feat: discord watching status + clickable links
2 parents b4a1674 + c68b8a4 commit 16dd96b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/main/discord.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ export default class Discord {
4545

4646
setDiscordRPC () {
4747
if (this.discord.user) {
48+
const mediaUrl = this.allowDiscordDetails ? 'https://anilist.co/anime/' + this.mediaId : 'https://hayase.watch'
49+
const mediaTitle = this.allowDiscordDetails ? this.session?.title ?? 'Anime' : 'Anime'
4850
const position = (this.position?.position ?? 0) * 1000
4951
const duration = (this.position?.duration ?? 0) * 1000
5052
const status = {
@@ -53,14 +55,19 @@ export default class Discord {
5355
type: 3,
5456
name: 'Hayase',
5557
state: this.allowDiscordDetails ? this.session?.description ?? 'Streaming anime torrents! 🍿' : 'Streaming anime torrents! 🍿',
56-
details: this.allowDiscordDetails ? this.session?.title ?? 'Looking around...' : 'Looking around...',
58+
details: mediaTitle,
59+
details_url: mediaUrl,
5760
timestamps: {
5861
start: this.allowDiscordDetails && this.position ? Date.now() - position : undefined,
5962
end: this.allowDiscordDetails && this.position && this.playback === 'playing' ? Date.now() + (duration - position) : undefined
6063
},
6164
assets: {
6265
large_image: this.allowDiscordDetails && this.session?.image ? this.session.image : 'logo',
63-
large_text: 'https://hayase.watch'
66+
large_text: mediaTitle,
67+
large_url: mediaUrl,
68+
small_image: 'logo',
69+
small_text: 'Watching on Hayase',
70+
small_url: 'https://hayase.watch'
6471
},
6572
buttons: [
6673
{
@@ -75,7 +82,8 @@ export default class Discord {
7582
party: {
7683
id: '1222'
7784
},
78-
instance: true
85+
instance: true,
86+
status_display_type: 2 // details
7987
}
8088
}
8189
this.discord.request('SET_ACTIVITY', status)

0 commit comments

Comments
 (0)