diff --git a/src/equicordplugins/moyai/index.ts b/src/equicordplugins/moyai/index.ts index f6c558bb..cbb94bad 100644 --- a/src/equicordplugins/moyai/index.ts +++ b/src/equicordplugins/moyai/index.ts @@ -52,6 +52,7 @@ interface IVoiceChannelEffectSendEvent { } const MOYAI = "🗿"; +const TIE = "👔"; 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_ULTRA = "https://pub-e77fd37d275f481896833bda931f1d70.r2.dev/moyai.WAV"; @@ -111,9 +112,10 @@ export default definePlugin({ if (channelId !== SelectedChannelStore.getChannelId()) return; const moyaiCount = getMoyaiCount(message.content); + const hasTie = message.content.includes(TIE); for (let i = 0; i < moyaiCount; i++) { - boom(); + boom(hasTie); await sleep(300); } }, @@ -125,17 +127,17 @@ export default definePlugin({ if (channelId !== SelectedChannelStore.getChannelId()) return; 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) { if (!emoji?.name) return; 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); } -function boom() { +function boom(forcedUltra = false) { if (!settings.store.triggerWhenUnfocused && !document.hasFocus()) return; 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_HD : MOYAI_URL); diff --git a/src/plugins/_core/supportHelper.tsx b/src/plugins/_core/supportHelper.tsx index 2234c612..345105a4 100644 --- a/src/plugins/_core/supportHelper.tsx +++ b/src/plugins/_core/supportHelper.tsx @@ -18,43 +18,25 @@ import { definePluginSettings } from "@api/Settings"; import { getUserSettingLazy } from "@api/UserSettings"; -import ErrorBoundary from "@components/ErrorBoundary"; -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 { Devs, EQUCORD_HELPERS, GUILD_ID, SUPPORT_CHANNEL_ID } from "@utils/constants"; import { sendMessage } from "@utils/discord"; import { Logger } from "@utils/Logger"; import { Margins } from "@utils/margins"; -import { isEquicordPluginDev, isPluginDev, tryOrElse } from "@utils/misc"; +import { tryOrElse } from "@utils/misc"; import { relaunch } from "@utils/native"; import { onlyOnce } from "@utils/onlyOnce"; import { makeCodeblock } from "@utils/text"; import definePlugin from "@utils/types"; -import { checkForUpdates, isOutdated, update } from "@utils/updater"; -import { Alerts, Button, Card, ChannelStore, Forms, GuildMemberStore, Parser, PermissionsBits, PermissionStore, RelationshipStore, showToast, Text, Toasts, UserStore } from "@webpack/common"; -import { JSX } from "react"; +import { checkForUpdates, update } from "@utils/updater"; +import { Button, GuildMemberStore, PermissionsBits, PermissionStore, showToast, Toasts } from "@webpack/common"; +import { type ReactElement } from "react"; import gitHash from "~git-hash"; import plugins, { PluginMeta } from "~plugins"; 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 ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!; async function forceUpdate() { @@ -63,7 +45,6 @@ async function forceUpdate() { await update(); relaunch(); } - return outdated; } @@ -75,14 +56,12 @@ async function generateDebugInfoMessage() { if (IS_VESKTOP) return `Vesktop v${VesktopNative.app.getVersion()}`; if (IS_EQUIBOP) return `Equibop v${VesktopNative.app.getVersion()}`; if ("legcord" in window) return `LegCord v${window.legcord.version}`; - - // @ts-expect-error - const name = typeof unsafeWindow !== "undefined" ? "UserScript" : "Web"; + const name = "Web"; return `${name} (${navigator.userAgent})`; })(); const info = { - Equicord: + ryncord: `v${VERSION} • [${gitHash}]()` + `${SettingsPlugin.additionalInfo} - ${Intl.DateTimeFormat("en-GB", { dateStyle: "medium" }).format(BUILD_TIMESTAMP)}`, Client: `${RELEASE_CHANNEL} ~ ${client}`, @@ -100,7 +79,6 @@ async function generateDebugInfoMessage() { const commonIssues = { "NoRPC enabled": Vencord.Plugins.isPluginEnabled("NoRPC"), "Activity Sharing disabled": tryOrElse(() => !ShowCurrentGame.getSetting(), false), - "Equicord DevBuild": !IS_STANDALONE, "Has UserPlugins": Object.values(PluginMeta).some(m => m.userPlugin), "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 enabledUserPlugins = enabledPlugins.filter(p => PluginMeta[p].userPlugin); - let content = `**Enabled Plugins (${enabledStockPlugins.length}):**\n${makeCodeblock(enabledStockPlugins.join(", "))}`; if (enabledUserPlugins.length) { 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:
- - - Before you ask for help, - We do not handle support for users who use 100+ plugins - issue could be plugin confliction - try removing some plugins and see if it fixes! -
, - cancelText: "Okay continue" - }); - } - return content; } const checkForUpdatesOnce = onlyOnce(checkForUpdates); - -const settings = definePluginSettings({}).withPrivateSettings<{ - dismissedDevBuildWarning?: boolean; -}>(); - -let clicked = false; +const settings = definePluginSettings({}); export default definePlugin({ name: "SupportHelper", - required: true, description: "Helps us provide support to you", authors: [Devs.Ven], - dependencies: ["UserSettingsAPI"], - - settings, - - patches: [{ - find: "#{intl::BEGINNING_DM}", - replacement: { - match: /#{intl::BEGINNING_DM},{.+?}\),(?=.{0,300}(\i)\.isMultiUserDM)/, - replace: "$& $self.renderContributorDmWarningCard({ channel: $1 })," - } - }], + required: true, + dependencies: ["UserSettingDefinitions"], commands: [ { - name: "equicord-debug", - description: "Send Equicord debug info", - // @ts-ignore - predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx?.guild?.id, + name: "ryncord-debug", + description: "Send ryncord debug info", execute: async () => ({ content: await generateDebugInfoMessage() }) }, { - name: "equicord-plugins", - description: "Send Equicord plugin list", - // @ts-ignore - predicate: ctx => isPluginDev(UserStore.getCurrentUser()?.id) || isEquicordPluginDev(UserStore.getCurrentUser()?.id) || GUILD_ID === ctx?.guild?.id, + name: "ryncord-plugins", + description: "Send ryncord plugin list", execute: () => { const pluginList = generatePluginList(); return { content: typeof pluginList === "string" ? pluginList : "Unable to generate plugin list." }; @@ -195,100 +136,22 @@ export default definePlugin({ ], flux: { - async CHANNEL_SELECT({ channelId }) { - 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:
- - - Before you ask for help, - Check for updates and if this - issue could be caused by Equicord! -
, - confirmText: "Go to Equicord Support", - cancelText: "Okay continue", - onConfirm: () => VencordNative.native.openExternal("https://discord.gg/5Xh2W87egW"), - }); - } - + async CHANNEL_SELECT() { if (!IS_UPDATER_DISABLED) { await checkForUpdatesOnce().catch(() => { }); - - if (isOutdated) { - return Alerts.show({ - title: "Hold on!", - body:
- You are using an outdated version of Equicord! Chances are, your issue is already fixed. - - Please first update before asking for support! - -
, - 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:
- You are using an externally updated Equicord version, the ability to help you here may be limited. - - Please join the Equicord Server for support, - or if this issue persists on Vencord, continue on. - -
- }); - } - - if (!IS_STANDALONE && !settings.store.dismissedDevBuildWarning) { - return Alerts.show({ - title: "Hold on!", - body:
- You are using a custom build of Equicord, which we do not provide support for! - - - We only provide support for official builds. - Either switch to an official build or figure your issue out yourself. - - - You will be banned from receiving support if you ignore this rule. -
, - confirmText: "Understood", - secondaryConfirmText: "Don't show again", - onConfirmSecondary: () => settings.store.dismissedDevBuildWarning = true - }); } } }, - renderMessageAccessory(props) { - const buttons = [] as JSX.Element[]; + renderMessageAccessory(props): ReactElement | null { + const buttons = [] as ReactElement[]; const equicordSupport = GuildMemberStore.getMember(GUILD_ID, props.message.author.id)?.roles?.includes(EQUCORD_HELPERS); const shouldAddUpdateButton = !IS_UPDATER_DISABLED - && ( - (props.channel.id === SUPPORT_CHANNEL_ID && equicordSupport) - ) + && props.channel.id === SUPPORT_CHANNEL_ID + && equicordSupport && props.message.content?.includes("update"); if (shouldAddUpdateButton) { @@ -303,7 +166,7 @@ export default definePlugin({ else showToast("Already up to date!", Toasts.Type.MESSAGE); } 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); } }} @@ -314,13 +177,13 @@ export default definePlugin({ } 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( , ); } - - if (equicordSupport) { - const match = CodeBlockRe.exec(props.message.content || props.message.embeds[0]?.rawDescription || ""); - if (match) { - buttons.push( - - ); - } - } } - return buttons.length - ? {buttons} - : 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 ( - - Please do not private message plugin developers for support! -
- Instead, use the support channel: {Parser.parse("https://discord.com/channels/1173279886065029291/1173342942858055721")} - {!ChannelStore.getChannel(SUPPORT_CHANNEL_ID) && " (Click the link to join)"} -
- ); - }, { noop: true }), + return buttons.length ?
{buttons}
: null; + } }); diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 0ec2820f..a79abb79 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -29,7 +29,7 @@ export const EQUIBOP_CONTRIB_ROLE_ID = "1287079931645263968"; export const VENCORD_CONTRIB_ROLE_ID = "1173343399470964856"; // Vencord -export const VC_SUPPORT_CHANNEL_ID = "1026515880080842772"; +export const VC_SUPPORT_CHANNEL_ID = "1224645211528105994"; export const VC_GUILD_ID = "1015060230222131221"; export const VENBOT_USER_ID = "1017176847865352332"; export const VC_DONOR_ROLE_ID = "1042507929485586532";