Skip to content

Commit

Permalink
feat(Ongaku): add presence (PreMiD#8295)
Browse files Browse the repository at this point in the history
* feat(user): add presence

* feat(Ongaku): fixed objects
  • Loading branch information
zvbt authored Apr 25, 2024
1 parent 3a9602a commit 3956816
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
22 changes: 22 additions & 0 deletions websites/O/Ongaku/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$schema": "https://schemas.premid.app/metadata/1.10",
"author": {
"id": "709704536821858304",
"name": "cyadine"
},
"service": "Ongaku",
"description": {
"en": "Discover the best of Jpop and Kpop on Ongaku your go-to platform for streaming all your favorite Japanese and Korean pop music hits. Dive into the latest tracks, timeless classics, and carefully curated playlists that celebrate the vibrant world of Jpop and Kpop music."
},
"url": "ongaku.zvbt.space",
"version": "1.0.0",
"logo": "https://ongaku.zvbt.space/favicon.png",
"thumbnail": "https://ongaku.zvbt.space/preview.png",
"color": "#cba6f7",
"category": "music",
"tags": [
"music",
"kpop",
"jpop"
]
}
71 changes: 71 additions & 0 deletions websites/O/Ongaku/presence.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
const presence = new Presence({
clientId: "1232447632765485126",
});

const enum Assets {
Logo = "https://ongaku.zvbt.space/favicon.png",
}

presence.on("UpdateData", async () => {
const song: string = document.title.split(" | ")[0],
artist = song.split(" - ")[0],
songname = song.split(" - ").pop();

if (document.location.pathname.match("/jpop")) {
const presenceDataJpop: PresenceData = {
largeImageKey: Assets.Logo,
details: "Listening to",
state: `${artist} - ${songname}`,
buttons: [
{
label: "Listen Along",
url: "https://ongaku.zvbt.space/jpop",
},
],
};
presence.setActivity(presenceDataJpop);
}

if (document.location.pathname.match("/song")) {
const presenceDataSong: PresenceData = {
largeImageKey: Assets.Logo,
details: "Browsing the songs lists",
buttons: [
{
label: "View the page",
url: "https://ongaku.zvbt.space/song",
},
],
};
presence.setActivity(presenceDataSong);
}

if (document.location.pathname.match("/about")) {
const presenceDataAbout: PresenceData = {
largeImageKey: Assets.Logo,
details: "Reading the about page",
buttons: [
{
label: "View the page",
url: "https://ongaku.zvbt.space/about",
},
],
};
presence.setActivity(presenceDataAbout);
}

if (document.location.pathname === "/") {
const presenceDataKpop: PresenceData = {
largeImageKey: Assets.Logo,
details: "Listening to",
state: `${artist} - ${songname}`,
buttons: [
{
label: "Listen Along",
url: "https://ongaku.zvbt.space",
},
],
};
presence.setActivity(presenceDataKpop);
}
});

0 comments on commit 3956816

Please sign in to comment.