forked from Galactic/galactic-bot
My brain is so massive
This commit is contained in:
parent
2fad9cc2d2
commit
a637f1df22
@ -132,6 +132,37 @@ export type InfractionType =
|
|||||||
| 'DELETE';
|
| 'DELETE';
|
||||||
|
|
||||||
export enum CommandOptionType {
|
export enum CommandOptionType {
|
||||||
|
SUB_COMMAND = 'SUB_COMMAND',
|
||||||
|
SUB_COMMAND_GROUP = 'SUB_COMMAND_GROUP',
|
||||||
|
ROLES = 'ROLES', // Note plurality, strings can parse users, roles, and channels.
|
||||||
|
MEMBERS = 'MEMBERS',
|
||||||
|
USERS = 'USERS',
|
||||||
|
CHANNELS = 'CHANNELS',
|
||||||
|
TEXT_CHANNELS = 'TEXT_CHANNELS',
|
||||||
|
VOICE_CHANNELS = 'VOICE_CHANNELS',
|
||||||
|
TIME = 'TIME', // timestring
|
||||||
|
DATE = 'DATE',
|
||||||
|
COMPONENT = 'COMPONENT',
|
||||||
|
COMPONENTS = 'COMPONENTS',
|
||||||
|
COMMAND = 'COMMAND',
|
||||||
|
COMMANDS = 'COMMANDS',
|
||||||
|
MODULE = 'MODULE',
|
||||||
|
STRING = 'STRING',
|
||||||
|
INTEGER = 'INTEGER',
|
||||||
|
BOOLEAN = 'BOOLEAN',
|
||||||
|
MEMBER = 'MEMBER',
|
||||||
|
USER = 'USER',
|
||||||
|
TEXT_CHANNEL = 'TEXT_CHANNEL',
|
||||||
|
VOICE_CHANNEL = 'VOICE_CHANNEL',
|
||||||
|
CHANNEL = 'CHANNEL',
|
||||||
|
ROLE = 'ROLE',
|
||||||
|
MENTIONABLE = 'MENTIONABLE',
|
||||||
|
NUMBER = 'NUMBER',
|
||||||
|
FLOAT = 'FLOAT',
|
||||||
|
POINTS = 'POINTS'
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum DiscordCommandOptionType {
|
||||||
SUB_COMMAND = 1,
|
SUB_COMMAND = 1,
|
||||||
SUB_COMMAND_GROUP = 2,
|
SUB_COMMAND_GROUP = 2,
|
||||||
ROLES = 3, // Note plurality, strings can parse users, roles, and channels.
|
ROLES = 3, // Note plurality, strings can parse users, roles, and channels.
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
||||||
// const { ChannelType } = require("discord.js");
|
|
||||||
// const { Util } = require("../../utilities");
|
|
||||||
|
|
||||||
import { Util } from '../../utilities/index.js';
|
import { Util } from '../../utilities/index.js';
|
||||||
import DiscordClient from '../DiscordClient.js';
|
import DiscordClient from '../DiscordClient.js';
|
||||||
import { CommandOptionChoices, CommandOptionParams, CommandOptionShape, CommandOptionType, DependsOnMode, FormatOpts, FormatParams, RawCommandOption } from '../../../@types/Client.js';
|
import { CommandOptionChoices, CommandOptionParams, CommandOptionShape, CommandOptionType, DependsOnMode, DiscordCommandOptionType, FormatOpts, FormatParams, RawCommandOption } from '../../../@types/Client.js';
|
||||||
import { GuildWrapper } from '../components/wrappers/index.js';
|
import { GuildWrapper } from '../components/wrappers/index.js';
|
||||||
import Component from './Component.js';
|
import Component from './Component.js';
|
||||||
import Command from './commands/Command.js';
|
import Command from './commands/Command.js';
|
||||||
@ -970,10 +966,13 @@ class CommandOption
|
|||||||
get shape (): CommandOptionShape
|
get shape (): CommandOptionShape
|
||||||
{
|
{
|
||||||
const cmdType = CommandOptionType[this.#type];
|
const cmdType = CommandOptionType[this.#type];
|
||||||
|
const type = DiscordCommandOptionType[this.#type];
|
||||||
|
if (!type)
|
||||||
|
throw new Error('Invalid command type: ' + type);
|
||||||
return {
|
return {
|
||||||
name: this.#name,
|
name: this.#name,
|
||||||
description: this.#description,
|
description: this.#description,
|
||||||
type: this.#type,
|
type,
|
||||||
required: this.#required,
|
required: this.#required,
|
||||||
choices: this.#choices,
|
choices: this.#choices,
|
||||||
options: this.#options.map((o) => o.shape as CommandOptionShape),
|
options: this.#options.map((o) => o.shape as CommandOptionShape),
|
||||||
|
Loading…
Reference in New Issue
Block a user