mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
change: command names can only be lowercase
This commit is contained in:
@@ -6,7 +6,7 @@ export interface ApplicationCommand {
|
|||||||
id: string;
|
id: string;
|
||||||
/** Unique id of the parent application */
|
/** Unique id of the parent application */
|
||||||
applicationId: string;
|
applicationId: string;
|
||||||
/** 1-32 character name matching `^[\w-]{1,32}$` */
|
/** 1-32 character name matching lowercase `^[\w-]{1,32}$` */
|
||||||
name: string;
|
name: string;
|
||||||
/** 1-100 character description */
|
/** 1-100 character description */
|
||||||
description: string;
|
description: string;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { DiscordApplicationCommandOptionTypes } from "./application_command_opti
|
|||||||
export interface ApplicationCommandOption {
|
export interface ApplicationCommandOption {
|
||||||
/** Value of Application Command Option Type */
|
/** Value of Application Command Option Type */
|
||||||
type: DiscordApplicationCommandOptionTypes;
|
type: DiscordApplicationCommandOptionTypes;
|
||||||
/** 1-32 character name matching `^[\w-]{1,32}$` */
|
/** 1-32 character name matching lowercase `^[\w-]{1,32}$` */
|
||||||
name: string;
|
name: string;
|
||||||
/** 1-100 character description */
|
/** 1-100 character description */
|
||||||
description: string;
|
description: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ApplicationCommandOption } from "./application_command_option.ts";
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command-json-params */
|
/** https://discord.com/developers/docs/interactions/slash-commands#create-global-application-command-json-params */
|
||||||
export interface CreateGlobalApplicationCommand {
|
export interface CreateGlobalApplicationCommand {
|
||||||
/** 1-31 character name matching `^[\w-]{1,32}$` */
|
/** 1-31 character name matching lowercase `^[\w-]{1,32}$` */
|
||||||
name: string;
|
name: string;
|
||||||
/** 1-100 character description */
|
/** 1-100 character description */
|
||||||
description: string;
|
description: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ApplicationCommandOption } from "./application_command_option.ts";
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command-json-params */
|
/** https://discord.com/developers/docs/interactions/slash-commands#create-guild-application-command-json-params */
|
||||||
export interface CreateGuildApplicationCommand {
|
export interface CreateGuildApplicationCommand {
|
||||||
/** 1-31 character name matching `^[\w-]{1,32}$` */
|
/** 1-31 character name matching lowercase `^[\w-]{1,32}$` */
|
||||||
name: string;
|
name: string;
|
||||||
/** 1-100 character description */
|
/** 1-100 character description */
|
||||||
description: string;
|
description: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ApplicationCommandOption } from "./application_command_option.ts";
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command-json-params */
|
/** https://discord.com/developers/docs/interactions/slash-commands#edit-global-application-command-json-params */
|
||||||
export interface EditGlobalApplicationCommand {
|
export interface EditGlobalApplicationCommand {
|
||||||
/** 1-31 character name matching `^[\w-]{1,32}$` */
|
/** 1-31 character name matching lowercase `^[\w-]{1,32}$` */
|
||||||
name?: string;
|
name?: string;
|
||||||
/** 1-100 character description */
|
/** 1-100 character description */
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ApplicationCommandOption } from "./application_command_option.ts";
|
|||||||
|
|
||||||
/** https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command-json-params */
|
/** https://discord.com/developers/docs/interactions/slash-commands#edit-guild-application-command-json-params */
|
||||||
export interface EditGuildApplicationCommand {
|
export interface EditGuildApplicationCommand {
|
||||||
/** 1-31 character name matching `^[\w-]{1,32}$` */
|
/** 1-31 character name matching lowercase `^[\w-]{1,32}$` */
|
||||||
name?: string;
|
name?: string;
|
||||||
/** 1-100 character description */
|
/** 1-100 character description */
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|||||||
+3
-1
@@ -185,7 +185,9 @@ export function validateSlashCommands(
|
|||||||
`Running for of loop in validateSlashCommands function.`,
|
`Running for of loop in validateSlashCommands function.`,
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
(command.name && !SLASH_COMMANDS_NAME_REGEX.test(command.name)) ||
|
(command.name &&
|
||||||
|
(!SLASH_COMMANDS_NAME_REGEX.test(command.name) ||
|
||||||
|
command.name.toLowerCase() !== command.name)) ||
|
||||||
(create && !command.name)
|
(create && !command.name)
|
||||||
) {
|
) {
|
||||||
throw new Error(Errors.INVALID_SLASH_NAME);
|
throw new Error(Errors.INVALID_SLASH_NAME);
|
||||||
|
|||||||
Reference in New Issue
Block a user