presence.ts 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. const presence = new Presence({
  2. clientId: "1094962047906758796",
  3. }),
  4. browsingTimestamp = Math.floor(Date.now() / 1000);
  5. const enum Assets {
  6. Logo = "https://cdn.rcd.gg/PreMiD/websites/I/Incels.is/assets/logo.png",
  7. }
  8. presence.on("UpdateData", async () => {
  9. const presenceData: PresenceData = {
  10. largeImageKey: Assets.Logo,
  11. startTimestamp: browsingTimestamp,
  12. },
  13. threadTitle = document.querySelector(".p-title-value")?.textContent,
  14. threadTag = document.querySelector(
  15. '[class*="label label--custom-"]'
  16. )?.textContent,
  17. { pathname } = document.location,
  18. { search } = document.location;
  19. if (pathname === "/")
  20. presenceData.details = "Hopelessly staring at the home page";
  21. else if (pathname.includes("/news-announcements"))
  22. presenceData.details = "Doom scrolling through news and announcements";
  23. else if (
  24. pathname.includes("/suggestions") &&
  25. pathname.includes("/post-thread")
  26. ) {
  27. presenceData.details =
  28. "Typing up a suggestion that will never be implemented";
  29. } else if (pathname.includes("/suggestions")) {
  30. presenceData.details =
  31. "Looking through suggestions that will never be implemented";
  32. } else if (pathname.includes("/rules-and-faq")) {
  33. presenceData.details =
  34. "Learning how to sit there and take it, like a good little boy";
  35. } else if (
  36. pathname.includes("/the-bunker") &&
  37. pathname.includes("/post-thread")
  38. )
  39. presenceData.details = "Typing up a post for the bunker dwellers";
  40. else if (pathname.includes("/the-bunker"))
  41. presenceData.details = "Seeking shelter in the bunker";
  42. else if (pathname.includes("/must-read-content"))
  43. presenceData.details = "Looking through the good stuff";
  44. else if (pathname.includes("/inceldom-discussion"))
  45. presenceData.details = "Looking through (recycled) discussions";
  46. else if (
  47. pathname.includes("/the-lounge") &&
  48. pathname.includes("/post-thread")
  49. )
  50. presenceData.details = "Typing up something unrelated to inceldom";
  51. else if (pathname.includes("/the-lounge"))
  52. presenceData.details = "He be loungin'";
  53. else if (
  54. pathname.includes("/the-sewers") &&
  55. pathname.includes("/post-thread")
  56. ) {
  57. presenceData.details =
  58. "Typing up a post for the sewer rats (probably just postmaxxing)";
  59. } else if (pathname.includes("/the-sewers"))
  60. presenceData.details = "Swimming through the sewers (yuck)";
  61. else if (
  62. pathname.includes("/ban-appeals") &&
  63. pathname.includes("/post-thread")
  64. )
  65. presenceData.details = "LET ME IN! REEEEEEEE!!!";
  66. else if (pathname.includes("/ban-appeals")) {
  67. presenceData.details =
  68. "Trying hard to get back in (or laughing at those who can't)";
  69. } else if (pathname.includes("/post-thread"))
  70. presenceData.details = "Typing up a controversial opinion";
  71. else if (pathname.includes("/conversations"))
  72. presenceData.details = "Currently e-socializing";
  73. else if (pathname.includes("/account/account-details"))
  74. presenceData.details = "Pimpin' out the profile";
  75. else if (pathname.includes("/members/")) {
  76. if (
  77. pathname.includes(
  78. document.querySelector(".p-navgroup-user-linkText")?.textContent
  79. )
  80. )
  81. presenceData.details = "Looking at self with disgust (it's over)";
  82. else presenceData.details = "Watching over other lost souls";
  83. } else if (pathname.includes("/account/preferences"))
  84. presenceData.details = "Customizing the experience";
  85. else if (pathname.includes("/help"))
  86. presenceData.details = "Looking for help (all help is too late)";
  87. else if (pathname.includes("/whats-new"))
  88. presenceData.details = "Looking for something new (it's all the same)";
  89. else if (pathname.includes("/find-threads/started"))
  90. presenceData.details = "Looking at the only good threads (the ones I made)";
  91. else if (pathname.includes("/watched/threads"))
  92. presenceData.details = "Checking up on watched threads";
  93. else if (pathname.includes("/chat/"))
  94. presenceData.details = "Talking to like-minded (based) individuals";
  95. else if (pathname.includes("/media/")) {
  96. presenceData.details =
  97. "Either looking at or posting memes, family friendly content (trust), or both";
  98. } else if (pathname.includes("/search/") && search.includes("?q=") === false)
  99. presenceData.details = "Searching for something really specific";
  100. else if (pathname.includes("/search/")) {
  101. presenceData.details = `Searching for "${
  102. document.querySelector(".p-title-value em").textContent
  103. }"`;
  104. } else if (pathname.includes("/threads/")) {
  105. if (threadTitle) {
  106. presenceData.details = "Reading a thread:";
  107. if (document.querySelector("[class*='nsfw']"))
  108. presenceData.state = "[Family friendly thread (trust)]";
  109. else {
  110. presenceData.state = threadTag
  111. ? threadTitle.replace(threadTag, `[${threadTag}]`)
  112. : threadTitle;
  113. }
  114. }
  115. } else presenceData.details = "Wandering around aimlessly";
  116. if (presenceData.details) presence.setActivity(presenceData);
  117. else presence.setActivity();
  118. });