diff --git a/src/equicordplugins/moreCommands/index.ts b/src/equicordplugins/moreCommands/index.ts index 5eeda23e7..fbed65807 100644 --- a/src/equicordplugins/moreCommands/index.ts +++ b/src/equicordplugins/moreCommands/index.ts @@ -19,7 +19,7 @@ import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, OptionalMessageOption, RequiredMessageOption, sendBotMessage } from "@api/Commands"; import { addMessagePreEditListener, addMessagePreSendListener, MessageObject, removeMessagePreEditListener, removeMessagePreSendListener } from "@api/MessageEvents"; import { migratePluginSettings } from "@api/Settings"; -import { Devs, EquicordDevs } from "@utils/constants"; +import { Devs, EquicordDevs, GUILD_IDS } from "@utils/constants"; import { sendMessage } from "@utils/discord"; import definePlugin from "@utils/types"; import { DraftType, UploadHandler, UploadManager, UserAffinitiesStore, UserStore } from "@webpack/common"; @@ -33,7 +33,7 @@ import { generatePoissonDiskPosition, getCuteAnimeBoys, getCuteNeko, - getMessage, + getFavoriteGif, isMorse, loadFriendImage, loadImage, @@ -470,9 +470,15 @@ export default definePlugin({ { name: "gifroulette", description: "Tempt fate and send a gif", - execute: (opts, other) => ({ - content: getMessage(opts, other) - }), + execute: (opts, other) => { + if (GUILD_IDS.includes(other?.guild?.id ?? "")) return sendBotMessage(other.channel.id, { + content: "This command is restricted in this server." + }); + + return { + content: getFavoriteGif(opts, other) + }; + } }, { inputType: ApplicationCommandInputType.BUILT_IN, diff --git a/src/equicordplugins/moreCommands/utils.ts b/src/equicordplugins/moreCommands/utils.ts index 4d34b41be..6bc7492dc 100644 --- a/src/equicordplugins/moreCommands/utils.ts +++ b/src/equicordplugins/moreCommands/utils.ts @@ -204,11 +204,9 @@ export function uwuifyArray(arr) { return newArr; } -export function getMessage(opts, other) { +export function getFavoriteGif(opts: CommandArgument[], other: CommandContext) { const frecencyStore = UserSettingsActionCreators.FrecencyUserSettingsActionCreators.getCurrentValue(); - const gifsArray = Object.keys(frecencyStore.favoriteGifs.gifs); - const chosenGifUrl = gifsArray[Math.floor(Math.random() * gifsArray.length)]; return `${chosenGifUrl}`;