diff --git a/src/commands/other/waifu.ts b/src/commands/other/waifu.ts index 345f31fd..b2594a35 100644 --- a/src/commands/other/waifu.ts +++ b/src/commands/other/waifu.ts @@ -4,17 +4,20 @@ import { EmbedBuilder } from '@discordjs/builders'; import { parseURL } from '@sapphire/utilities'; import { Command, RegisterCommand, type InteractionArguments } from '@skyra/http-framework'; import { applyLocalizedBuilder, createSelectMenuChoiceName, resolveKey } from '@skyra/http-framework-i18n'; +import { ApplicationIntegrationType, InteractionContextType } from 'discord-api-types/v10'; @RegisterCommand((builder) => - applyLocalizedBuilder(builder, LanguageKeys.Commands.Waifu.RootName, LanguageKeys.Commands.Waifu.RootDescription).addStringOption((builder) => - applyLocalizedBuilder(builder, LanguageKeys.Commands.Waifu.OptionRange) // - .addChoices( + applyLocalizedBuilder(builder, LanguageKeys.Commands.Waifu.RootName, LanguageKeys.Commands.Waifu.RootDescription) + .setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall) + .setContexts(InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel) + .addStringOption((builder) => + applyLocalizedBuilder(builder, LanguageKeys.Commands.Waifu.OptionRange).addChoices( createSelectMenuChoiceName(LanguageKeys.Commands.Waifu.KeyAll, { value: 'all' }), createSelectMenuChoiceName(LanguageKeys.Commands.Waifu.KeyMediumQuality, { value: 'medium' }), createSelectMenuChoiceName(LanguageKeys.Commands.Waifu.KeyHighQuality, { value: 'high' }), createSelectMenuChoiceName(LanguageKeys.Commands.Waifu.KeyLowQuality, { value: 'low' }) ) - ) + ) ) export class UserCommand extends Command { /** Potential sizes for the generated faces */ diff --git a/src/commands/search/anime.ts b/src/commands/search/anime.ts index 3cca6d9b..dc0732f4 100644 --- a/src/commands/search/anime.ts +++ b/src/commands/search/anime.ts @@ -3,11 +3,14 @@ import { LanguageKeys } from '#lib/i18n/LanguageKeys'; import { AnimeCommand } from '#lib/structures/AnimeCommand'; import { Command, RegisterCommand } from '@skyra/http-framework'; import { applyLocalizedBuilder } from '@skyra/http-framework-i18n'; +import { ApplicationIntegrationType, InteractionContextType } from 'discord-api-types/v10'; const Root = LanguageKeys.Commands.AniList.Anime; @RegisterCommand((builder) => - applyLocalizedBuilder(builder, Root.RootName, Root.RootDescription) // + applyLocalizedBuilder(builder, Root.RootName, Root.RootDescription) + .setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall) + .setContexts(InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel) .addIntegerOption((option) => applyLocalizedBuilder(option, Root.OptionsAnime).setRequired(true).setAutocomplete(true)) ) export class UserCommand extends AnimeCommand<'anime'> { diff --git a/src/commands/search/manga.ts b/src/commands/search/manga.ts index 671f3e32..f2dff8c1 100644 --- a/src/commands/search/manga.ts +++ b/src/commands/search/manga.ts @@ -3,11 +3,14 @@ import { LanguageKeys } from '#lib/i18n/LanguageKeys'; import { AnimeCommand } from '#lib/structures/AnimeCommand'; import { Command, RegisterCommand } from '@skyra/http-framework'; import { applyLocalizedBuilder } from '@skyra/http-framework-i18n'; +import { ApplicationIntegrationType, InteractionContextType } from 'discord-api-types/v10'; const Root = LanguageKeys.Commands.AniList.Manga; @RegisterCommand((builder) => - applyLocalizedBuilder(builder, Root.RootName, Root.RootDescription) // + applyLocalizedBuilder(builder, Root.RootName, Root.RootDescription) + .setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall) + .setContexts(InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel) .addIntegerOption((option) => applyLocalizedBuilder(option, Root.OptionsManga).setRequired(true).setAutocomplete(true)) ) export class UserCommand extends AnimeCommand<'manga'> { diff --git a/src/lib/utilities/create-command.ts b/src/lib/utilities/create-command.ts index 8f7304ce..98a17f60 100644 --- a/src/lib/utilities/create-command.ts +++ b/src/lib/utilities/create-command.ts @@ -4,20 +4,21 @@ import { SlashCommandBuilder } from '@discordjs/builders'; import { isNullish } from '@sapphire/utilities'; import { RegisterCommand } from '@skyra/http-framework'; import { applyLocalizedBuilder } from '@skyra/http-framework-i18n'; +import { ApplicationIntegrationType, InteractionContextType } from 'discord-api-types/v10'; + +const Root = LanguageKeys.Commands.Anime; export function createCommand(options: createCommand.Options): typeof WeebCommand { const name = new URL(options.path).searchParams.get('name'); if (isNullish(name)) throw new TypeError('The provided path lacks of a "name" querystring parameter.'); - const builder = applyLocalizedBuilder( - new SlashCommandBuilder(), - LanguageKeys.Commands.Anime.CommandName(name), - LanguageKeys.Commands.Anime.CommandDescription(name) - ); + const builder = applyLocalizedBuilder(new SlashCommandBuilder(), Root.CommandName(name), Root.CommandDescription(name)) + .setIntegrationTypes(ApplicationIntegrationType.GuildInstall, ApplicationIntegrationType.UserInstall) + .setContexts(InteractionContextType.Guild, InteractionContextType.PrivateChannel); if (options.user) { builder.addUserOption((builder) => - applyLocalizedBuilder(builder, LanguageKeys.Commands.Anime.UserOptionName, LanguageKeys.Commands.Anime.OptionDescription(name)) // + applyLocalizedBuilder(builder, Root.UserOptionName, Root.OptionDescription(name)) // .setRequired(options.userRequired ?? false) ); }