From 706d24143a47a8c72cb1c25147f7508d40e31987 Mon Sep 17 00:00:00 2001 From: Nanakusa <73281112+yofukashino@users.noreply.github.com> Date: Sat, 6 Jul 2024 22:19:26 +0530 Subject: [PATCH] slash command ephemeral message fix (#614) Co-authored-by: Colin <63314105+colin273@users.noreply.github.com> Co-authored-by: colin273 --- src/constants.ts | 1 + src/renderer/apis/commands.ts | 3 ++- src/renderer/coremods/commands/index.ts | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index aef4aa989..e27a5339b 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -3,3 +3,4 @@ export const WEBLATE_URL = "https://i18n.replugged.dev"; export const WEBSITE_URL = "https://replugged.dev"; export const BETA_WEBSITE_URL = "https://beta.replugged.dev"; export const DISCORD_BLURPLE = "#7289da"; +export const REPLUGGED_CLYDE_ID = "826980768571716968"; // "REPLUGGED" in ASCII codes diff --git a/src/renderer/apis/commands.ts b/src/renderer/apis/commands.ts index fbd7f4f8e..be3f26871 100644 --- a/src/renderer/apis/commands.ts +++ b/src/renderer/apis/commands.ts @@ -17,6 +17,7 @@ import type { Store } from "../modules/common/flux"; import { Logger } from "../modules/logger"; import { filters, getByStoreName, waitForModule } from "../modules/webpack"; import icon from "../assets/logo.png"; +import { REPLUGGED_CLYDE_ID } from "../../constants"; const logger = Logger.api("Commands"); let RepluggedUser: User | undefined; @@ -29,7 +30,7 @@ interface CommandsAndSection { void waitForModule(filters.bySource("hasHadPremium(){")).then((User) => { RepluggedUser = new User({ avatar: "replugged", - id: "replugged", + id: REPLUGGED_CLYDE_ID, bot: true, username: "Replugged", system: true, diff --git a/src/renderer/coremods/commands/index.ts b/src/renderer/coremods/commands/index.ts index e72011d5a..8d671c571 100644 --- a/src/renderer/coremods/commands/index.ts +++ b/src/renderer/coremods/commands/index.ts @@ -12,6 +12,7 @@ import { import { commandAndSections, defaultSection } from "../../apis/commands"; import { loadCommands, unloadCommands } from "./commands"; +import { REPLUGGED_CLYDE_ID } from "../../../constants"; const logger = Logger.api("Commands"); const injector = new Injector(); @@ -293,7 +294,7 @@ async function injectProfileFetch(): Promise { ); const fetchProfileKey = getFunctionKeyBySource(mod, "fetchProfile")!; injector.instead(mod, fetchProfileKey, (args, res) => { - if (args[0] === "replugged") { + if (args[0] === REPLUGGED_CLYDE_ID) { return; } return res(...args);