Skip to content

Commit

Permalink
fix(Character.AI): add /chat (PreMiD#7766)
Browse files Browse the repository at this point in the history
  • Loading branch information
joerkig authored Nov 26, 2023
1 parent eacef15 commit a5ed126
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion websites/C/Character.AI/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"beta.character.ai",
"character.ai"
],
"version": "1.0.1",
"version": "1.0.2",
"logo": "https://cdn.rcd.gg/PreMiD/websites/C/Character.AI/assets/logo.png",
"thumbnail": "https://cdn.rcd.gg/PreMiD/websites/C/Character.AI/assets/thumbnail.png",
"color": "#242525",
Expand Down
17 changes: 11 additions & 6 deletions websites/C/Character.AI/presence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ presence.on("UpdateData", async () => {
presence.getSetting<boolean>("time"),
presence.getSetting<boolean>("buttons"),
]),
{ pathname, href, origin } = document.location,
button = {
label: "View Page",
url: document.location.href,
url: href,
};

switch (document.location.pathname.split("/")[1]) {
switch (pathname.split("/")[1]) {
case "": {
presenceData.details = "Browsing Homepage";
break;
Expand All @@ -34,17 +35,21 @@ presence.on("UpdateData", async () => {
presenceData.buttons = [button];
break;
}
case "chat": {
presenceData.details = "Chatting with";
presenceData.state =
document.querySelector(".chattitle")?.childNodes[1]?.textContent;
presenceData.buttons = [button];
break;
}
case "feed": {
presenceData.details = "Browsing feed";
break;
}
case "post": {
presenceData.details = "Viewing post";
presenceData.state = document.querySelector(
`a[href^='${document.location.href.replace(
document.location.origin,
""
)}']`
`a[href^='${href.replace(origin, "")}']`
).textContent;
presenceData.buttons = [button];
break;
Expand Down

0 comments on commit a5ed126

Please sign in to comment.