feat: add support for TIE emoji and update boom function logic

refactor: rename Equicord references to ryncord in SupportHelper
fix: update VC_SUPPORT_CHANNEL_ID to the correct value in constants
This commit is contained in:
Rayanzay 2025-06-03 22:26:54 +10:00
parent cdeccda3df
commit 61ec098714
3 changed files with 35 additions and 209 deletions

View file

@ -52,6 +52,7 @@ interface IVoiceChannelEffectSendEvent {
} }
const MOYAI = "🗿"; const MOYAI = "🗿";
const TIE = "👔";
const MOYAI_URL = "https://github.com/Equicord/Equibored/raw/main/sounds/moyai/moyai.mp3"; const MOYAI_URL = "https://github.com/Equicord/Equibored/raw/main/sounds/moyai/moyai.mp3";
const MOYAI_URL_HD = "https://github.com/Equicord/Equibored/raw/main/sounds/moyai/moyai.wav"; const MOYAI_URL_HD = "https://github.com/Equicord/Equibored/raw/main/sounds/moyai/moyai.wav";
const MOYAI_URL_ULTRA = "https://pub-e77fd37d275f481896833bda931f1d70.r2.dev/moyai.WAV"; const MOYAI_URL_ULTRA = "https://pub-e77fd37d275f481896833bda931f1d70.r2.dev/moyai.WAV";
@ -111,9 +112,10 @@ export default definePlugin({
if (channelId !== SelectedChannelStore.getChannelId()) return; if (channelId !== SelectedChannelStore.getChannelId()) return;
const moyaiCount = getMoyaiCount(message.content); const moyaiCount = getMoyaiCount(message.content);
const hasTie = message.content.includes(TIE);
for (let i = 0; i < moyaiCount; i++) { for (let i = 0; i < moyaiCount; i++) {
boom(); boom(hasTie);
await sleep(300); await sleep(300);
} }
}, },
@ -125,17 +127,17 @@ export default definePlugin({
if (channelId !== SelectedChannelStore.getChannelId()) return; if (channelId !== SelectedChannelStore.getChannelId()) return;
const name = emoji.name.toLowerCase(); const name = emoji.name.toLowerCase();
if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return; if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai") && name !== TIE.toLowerCase()) return;
boom(); boom(name === TIE.toLowerCase());
}, },
VOICE_CHANNEL_EFFECT_SEND({ emoji }: IVoiceChannelEffectSendEvent) { VOICE_CHANNEL_EFFECT_SEND({ emoji }: IVoiceChannelEffectSendEvent) {
if (!emoji?.name) return; if (!emoji?.name) return;
const name = emoji.name.toLowerCase(); const name = emoji.name.toLowerCase();
if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai")) return; if (name !== MOYAI && !name.includes("moyai") && !name.includes("moai") && name !== TIE.toLowerCase()) return;
boom(); boom(name === TIE.toLowerCase());
} }
} }
}); });
@ -169,11 +171,11 @@ function getMoyaiCount(message: string) {
return Math.min(count, 10); return Math.min(count, 10);
} }
function boom() { function boom(forcedUltra = false) {
if (!settings.store.triggerWhenUnfocused && !document.hasFocus()) return; if (!settings.store.triggerWhenUnfocused && !document.hasFocus()) return;
const audioElement = document.createElement("audio"); const audioElement = document.createElement("audio");
audioElement.src = settings.store.ultraMode audioElement.src = (forcedUltra || settings.store.ultraMode)
? (settings.store.quality === "HD" ? MOYAI_URL_ULTRA_HD : MOYAI_URL_ULTRA) ? (settings.store.quality === "HD" ? MOYAI_URL_ULTRA_HD : MOYAI_URL_ULTRA)
: (settings.store.quality === "HD" ? MOYAI_URL_HD : MOYAI_URL); : (settings.store.quality === "HD" ? MOYAI_URL_HD : MOYAI_URL);

View file

@ -18,43 +18,25 @@
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { getUserSettingLazy } from "@api/UserSettings"; import { getUserSettingLazy } from "@api/UserSettings";
import ErrorBoundary from "@components/ErrorBoundary"; import { Devs, EQUCORD_HELPERS, GUILD_ID, SUPPORT_CHANNEL_ID } from "@utils/constants";
import { Flex } from "@components/Flex";
import { Link } from "@components/Link";
import { openUpdaterModal } from "@components/VencordSettings/UpdaterTab";
import { CONTRIB_ROLE_ID, Devs, DONOR_ROLE_ID, EQUCORD_HELPERS, EQUIBOP_CONTRIB_ROLE_ID, EQUICORD_TEAM, GUILD_ID, SUPPORT_CHANNEL_ID, VC_CONTRIB_ROLE_ID, VC_DONOR_ROLE_ID, VC_GUILD_ID, VC_REGULAR_ROLE_ID, VC_SUPPORT_CHANNEL_ID, VENCORD_CONTRIB_ROLE_ID } from "@utils/constants";
import { sendMessage } from "@utils/discord"; import { sendMessage } from "@utils/discord";
import { Logger } from "@utils/Logger"; import { Logger } from "@utils/Logger";
import { Margins } from "@utils/margins"; import { Margins } from "@utils/margins";
import { isEquicordPluginDev, isPluginDev, tryOrElse } from "@utils/misc"; import { tryOrElse } from "@utils/misc";
import { relaunch } from "@utils/native"; import { relaunch } from "@utils/native";
import { onlyOnce } from "@utils/onlyOnce"; import { onlyOnce } from "@utils/onlyOnce";
import { makeCodeblock } from "@utils/text"; import { makeCodeblock } from "@utils/text";
import definePlugin from "@utils/types"; import definePlugin from "@utils/types";
import { checkForUpdates, isOutdated, update } from "@utils/updater"; import { checkForUpdates, update } from "@utils/updater";
import { Alerts, Button, Card, ChannelStore, Forms, GuildMemberStore, Parser, PermissionsBits, PermissionStore, RelationshipStore, showToast, Text, Toasts, UserStore } from "@webpack/common"; import { Button, GuildMemberStore, PermissionsBits, PermissionStore, showToast, Toasts } from "@webpack/common";
import { JSX } from "react"; import { type ReactElement } from "react";
import gitHash from "~git-hash"; import gitHash from "~git-hash";
import plugins, { PluginMeta } from "~plugins"; import plugins, { PluginMeta } from "~plugins";
import SettingsPlugin from "./settings"; import SettingsPlugin from "./settings";
const CodeBlockRe = /```js\n(.+?)```/s;
const TrustedRolesIds = [
VC_CONTRIB_ROLE_ID, // Vencord Contributor
VC_REGULAR_ROLE_ID, // Vencord Regular
VC_DONOR_ROLE_ID, // Vencord Donor
EQUICORD_TEAM, // Equicord Team
DONOR_ROLE_ID, // Equicord Donor
CONTRIB_ROLE_ID, // Equicord Contributor
EQUIBOP_CONTRIB_ROLE_ID, // Equibop Contributor
VENCORD_CONTRIB_ROLE_ID, // Vencord Contributor
];
const AsyncFunction = async function () { }.constructor; const AsyncFunction = async function () { }.constructor;
const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!; const ShowCurrentGame = getUserSettingLazy<boolean>("status", "showCurrentGame")!;
async function forceUpdate() { async function forceUpdate() {
@ -63,7 +45,6 @@ async function forceUpdate() {
await update(); await update();
relaunch(); relaunch();
} }
return outdated; return outdated;
} }
@ -75,14 +56,12 @@ async function generateDebugInfoMessage() {
if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`; if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`;
if (IS_EQUIBOP) return `Equibop v${VesktopNative.app.getVersion()}`; if (IS_EQUIBOP) return `Equibop v${VesktopNative.app.getVersion()}`;
if ("legcord" in window) return `LegCord v${window.legcord.version}`; if ("legcord" in window) return `LegCord v${window.legcord.version}`;
const name = "Web";
// @ts-expect-error
const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web";
return `${name} (${navigator.userAgent})`; return `${name} (${navigator.userAgent})`;
})(); })();
const info = { const info = {
Equicord: ryncord:
`v${VERSION} • [${gitHash}](<https://github.com/Rayanzay/ryncord/commit/${gitHash}>)` + `v${VERSION} • [${gitHash}](<https://github.com/Rayanzay/ryncord/commit/${gitHash}>)` +
`${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat("en-GB", { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`, `${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat("en-GB", { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`,
Client: `${RELEASE_CHANNEL} ~ ${client}`, Client: `${RELEASE_CHANNEL} ~ ${client}`,
@ -100,7 +79,6 @@ async function generateDebugInfoMessage() {
const commonIssues = { const commonIssues = {
"NoRPC enabled": Vencord.Plugins.isPluginEnabled("NoRPC"), "NoRPC enabled": Vencord.Plugins.isPluginEnabled("NoRPC"),
"Activity Sharing disabled": tryOrElse(() => !ShowCurrentGame.getSetting(), false), "Activity Sharing disabled": tryOrElse(() => !ShowCurrentGame.getSetting(), false),
"Equicord DevBuild": !IS_STANDALONE,
"Has UserPlugins": Object.values(PluginMeta).some(m => m.userPlugin), "Has UserPlugins": Object.values(PluginMeta).some(m => m.userPlugin),
"More than two weeks out of date": BUILD_TIMESTAMP < Date.now() - 12096e5, "More than two weeks out of date": BUILD_TIMESTAMP < Date.now() - 12096e5,
}; };
@ -122,71 +100,34 @@ function generatePluginList() {
const enabledStockPlugins = enabledPlugins.filter(p => !PluginMeta[p].userPlugin); const enabledStockPlugins = enabledPlugins.filter(p => !PluginMeta[p].userPlugin);
const enabledUserPlugins = enabledPlugins.filter(p => PluginMeta[p].userPlugin); const enabledUserPlugins = enabledPlugins.filter(p => PluginMeta[p].userPlugin);
let content = `**Enabled Plugins (${enabledStockPlugins.length}):**\n${makeCodeblock(enabledStockPlugins.join(", "))}`; let content = `**Enabled Plugins (${enabledStockPlugins.length}):**\n${makeCodeblock(enabledStockPlugins.join(", "))}`;
if (enabledUserPlugins.length) { if (enabledUserPlugins.length) {
content += `**Enabled UserPlugins (${enabledUserPlugins.length}):**\n${makeCodeblock(enabledUserPlugins.join(", "))}`; content += `**Enabled UserPlugins (${enabledUserPlugins.length}):**\n${makeCodeblock(enabledUserPlugins.join(", "))}`;
} }
if (enabledPlugins.length > 100 && !(isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id))) {
return Alerts.show({
title: "You are attempting to get support!",
body: <div>
<style>
{'[class*="backdrop_"][style*="backdrop-filter"]{backdrop-filter:blur(16px) brightness(0.25) !important;}'}
</style>
<img src="https://media.tenor.com/QtGqjwBpRzwAAAAi/wumpus-dancing.gif" />
<Forms.FormText>Before you ask for help,</Forms.FormText>
<Forms.FormText>We do not handle support for users who use 100+ plugins</Forms.FormText>
<Forms.FormText>issue could be plugin confliction</Forms.FormText>
<Forms.FormText>try removing some plugins and see if it fixes!</Forms.FormText>
</div>,
cancelText: "Okay continue"
});
}
return content; return content;
} }
const checkForUpdatesOnce = onlyOnce(checkForUpdates); const checkForUpdatesOnce = onlyOnce(checkForUpdates);
const settings = definePluginSettings({});
const settings = definePluginSettings({}).withPrivateSettings<{
dismissedDevBuildWarning?: boolean;
}>();
let clicked = false;
export default definePlugin({ export default definePlugin({
name: "SupportHelper", name: "SupportHelper",
required: true,
description: "Helps us provide support to you", description: "Helps us provide support to you",
authors: [Devs.Ven], authors: [Devs.Ven],
dependencies: ["UserSettingsAPI"], required: true,
dependencies: ["UserSettingDefinitions"],
settings,
patches: [{
find: "#{intl::BEGINNING_DM}",
replacement: {
match: /#{intl::BEGINNING_DM},{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/,
replace: "$& $self.renderContributorDmWarningCard({ channel: $1 }),"
}
}],
commands: [ commands: [
{ {
name: "equicord-debug", name: "ryncord-debug",
description: "Send Equicord debug info", description: "Send ryncord debug info",
// @ts-ignore
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx?.guild?.id,
execute: async () => ({ content: await generateDebugInfoMessage() }) execute: async () => ({ content: await generateDebugInfoMessage() })
}, },
{ {
name: "equicord-plugins", name: "ryncord-plugins",
description: "Send Equicord plugin list", description: "Send ryncord plugin list",
// @ts-ignore
predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx?.guild?.id,
execute: () => { execute: () => {
const pluginList = generatePluginList(); const pluginList = generatePluginList();
return { content: typeof pluginList === "string" ? pluginList : "Unable to generate plugin list." }; return { content: typeof pluginList === "string" ? pluginList : "Unable to generate plugin list." };
@ -195,100 +136,22 @@ export default definePlugin({
], ],
flux: { flux: {
async CHANNEL_SELECT({ channelId }) { async CHANNEL_SELECT() {
const isSupportChannel = channelId === SUPPORT_CHANNEL_ID;
if (!isSupportChannel) return;
const selfId = UserStore.getCurrentUser()?.id;
if (!selfId || isPluginDev(selfId) || isEquicordPluginDev(selfId)) return;
if (channelId === VC_SUPPORT_CHANNEL_ID && Vencord.Plugins.isPluginEnabled("VCSupport") && !clicked) {
clicked = true;
return Alerts.show({
title: "You are entering the support channel!",
body: <div>
<style>
{'[class*="backdrop_"][style*="backdrop-filter"]{backdrop-filter:blur(16px) brightness(0.25) !important;}'}
</style>
<img src="https://media.tenor.com/QtGqjwBpRzwAAAAi/wumpus-dancing.gif" />
<Forms.FormText>Before you ask for help,</Forms.FormText>
<Forms.FormText>Check for updates and if this</Forms.FormText>
<Forms.FormText>issue could be caused by Equicord!</Forms.FormText>
</div>,
confirmText: "Go to Equicord Support",
cancelText: "Okay continue",
onConfirm: () => VencordNative.native.openExternal("https://discord.gg/5Xh2W87egW"),
});
}
if (!IS_UPDATER_DISABLED) { if (!IS_UPDATER_DISABLED) {
await checkForUpdatesOnce().catch(() => { }); await checkForUpdatesOnce().catch(() => { });
if (isOutdated) {
return Alerts.show({
title: "Hold on!",
body: <div>
<Forms.FormText>You are using an outdated version of Equicord! Chances are, your issue is already fixed.</Forms.FormText>
<Forms.FormText className={Margins.top8}>
Please first update before asking for support!
</Forms.FormText>
</div>,
onCancel: () => openUpdaterModal!(),
cancelText: "View Updates",
confirmText: "Update & Restart Now",
onConfirm: forceUpdate,
secondaryConfirmText: "I know what I'm doing or I can't update"
});
}
}
// @ts-ignore outdated type
const roles = GuildMemberStore.getSelfMember(VC_GUILD_ID)?.roles || GuildMemberStore.getSelfMember(GUILD_ID)?.roles;
if (!roles || TrustedRolesIds.some(id => roles.includes(id))) return;
if (!IS_WEB && IS_UPDATER_DISABLED) {
return Alerts.show({
title: "Hold on!",
body: <div>
<Forms.FormText>You are using an externally updated Equicord version, the ability to help you here may be limited.</Forms.FormText>
<Forms.FormText className={Margins.top8}>
Please join the <Link href="https://discord.gg/5Xh2W87egW">Equicord Server</Link> for support,
or if this issue persists on Vencord, continue on.
</Forms.FormText>
</div>
});
}
if (!IS_STANDALONE && !settings.store.dismissedDevBuildWarning) {
return Alerts.show({
title: "Hold on!",
body: <div>
<Forms.FormText>You are using a custom build of Equicord, which we do not provide support for!</Forms.FormText>
<Forms.FormText className={Margins.top8}>
We only provide support for <Link href="https://github.com/Rayanzay/ryncord">official builds</Link>.
Either <Link href="https://github.com/Rayanzay/rynstaller">switch to an official build</Link> or figure your issue out yourself.
</Forms.FormText>
<Text variant="text-md/bold" className={Margins.top8}>You will be banned from receiving support if you ignore this rule.</Text>
</div>,
confirmText: "Understood",
secondaryConfirmText: "Don't show again",
onConfirmSecondary: () => settings.store.dismissedDevBuildWarning = true
});
} }
} }
}, },
renderMessageAccessory(props) { renderMessageAccessory(props): ReactElement | null {
const buttons = [] as JSX.Element[]; const buttons = [] as ReactElement[];
const equicordSupport = GuildMemberStore.getMember(GUILD_ID, props.message.author.id)?.roles?.includes(EQUCORD_HELPERS); const equicordSupport = GuildMemberStore.getMember(GUILD_ID, props.message.author.id)?.roles?.includes(EQUCORD_HELPERS);
const shouldAddUpdateButton = const shouldAddUpdateButton =
!IS_UPDATER_DISABLED !IS_UPDATER_DISABLED
&& ( && props.channel.id === SUPPORT_CHANNEL_ID
(props.channel.id === SUPPORT_CHANNEL_ID && equicordSupport) && equicordSupport
)
&& props.message.content?.includes("update"); && props.message.content?.includes("update");
if (shouldAddUpdateButton) { if (shouldAddUpdateButton) {
@ -303,7 +166,7 @@ export default definePlugin({
else else
showToast("Already up to date!", Toasts.Type.MESSAGE); showToast("Already up to date!", Toasts.Type.MESSAGE);
} catch (e) { } catch (e) {
new Logger(this.name).error("Error while updating:", e); new Logger("SupportHelper").error("Error while updating:", e);
showToast("Failed to update :(", Toasts.Type.FAILURE); showToast("Failed to update :(", Toasts.Type.FAILURE);
} }
}} }}
@ -314,13 +177,13 @@ export default definePlugin({
} }
if (props.channel.id === SUPPORT_CHANNEL_ID && PermissionStore.can(PermissionsBits.SEND_MESSAGES, props.channel)) { if (props.channel.id === SUPPORT_CHANNEL_ID && PermissionStore.can(PermissionsBits.SEND_MESSAGES, props.channel)) {
if (props.message.content.includes("/equicord-debug") || props.message.content.includes("/equicord-plugins")) { if (props.message.content.includes("/ryncord-debug") || props.message.content.includes("/ryncord-plugins")) {
buttons.push( buttons.push(
<Button <Button
key="vc-dbg" key="vc-dbg"
onClick={async () => sendMessage(props.channel.id, { content: await generateDebugInfoMessage() })} onClick={async () => sendMessage(props.channel.id, { content: await generateDebugInfoMessage() })}
> >
Run /equicord-debug Run /ryncord-debug
</Button>, </Button>,
<Button <Button
key="vc-plg-list" key="vc-plg-list"
@ -331,51 +194,12 @@ export default definePlugin({
} }
}} }}
> >
Run /equicord-plugins Run /ryncord-plugins
</Button>
);
}
if (equicordSupport) {
const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || "");
if (match) {
buttons.push(
<Button
key="vc-run-snippet"
onClick={async () => {
try {
await AsyncFunction(match[1])();
showToast("Success!", Toasts.Type.SUCCESS);
} catch (e) {
new Logger(this.name).error("Error while running snippet:", e);
showToast("Failed to run snippet :(", Toasts.Type.FAILURE);
}
}}
>
Run Snippet
</Button> </Button>
); );
} }
} }
return buttons.length ? <div className={Margins.top8}>{buttons}</div> : null;
} }
return buttons.length
? <Flex>{buttons}</Flex>
: null;
},
renderContributorDmWarningCard: ErrorBoundary.wrap(({ channel }) => {
const userId = channel.getRecipientId();
if (!isPluginDev(userId) || !isEquicordPluginDev(userId)) return null;
if (RelationshipStore.isFriend(userId) || isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id)) return null;
return (
<Card className={`vc-plugins-restart-card ${Margins.top8}`}>
Please do not private message plugin developers for support!
<br />
Instead, use the support channel: {Parser.parse("https://discord.com/channels/1173279886065029291/1173342942858055721")}
{!ChannelStore.getChannel(SUPPORT_CHANNEL_ID) && " (Click the link to join)"}
</Card>
);
}, { noop: true }),
}); });

View file

@ -29,7 +29,7 @@ export const EQUIBOP_CONTRIB_ROLE_ID = "1287079931645263968";
export const VENCORD_CONTRIB_ROLE_ID = "1173343399470964856"; export const VENCORD_CONTRIB_ROLE_ID = "1173343399470964856";
// Vencord // Vencord
export const VC_SUPPORT_CHANNEL_ID = "1026515880080842772"; export const VC_SUPPORT_CHANNEL_ID = "1224645211528105994";
export const VC_GUILD_ID = "1015060230222131221"; export const VC_GUILD_ID = "1015060230222131221";
export const VENBOT_USER_ID = "1017176847865352332"; export const VENBOT_USER_ID = "1017176847865352332";
export const VC_DONOR_ROLE_ID = "1042507929485586532"; export const VC_DONOR_ROLE_ID = "1042507929485586532";