restrict gif roulette to not be able to be ran in vc or ec

This commit is contained in:
thororen1234 2026-06-04 11:58:56 -04:00
parent d06e203a2a
commit 43fd385dba
No known key found for this signature in database
2 changed files with 12 additions and 8 deletions

View file

@ -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,

View file

@ -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}`;