Skip to content

Commit 6582c1c

Browse files
committed
Major overhaul on how we store our commands
1 parent 1549af4 commit 6582c1c

File tree

349 files changed

+2615
-1828
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

349 files changed

+2615
-1828
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"dependencies": {
1111
"@sentry/node": "^6.4.1",
1212
"chrono-node": "^2.3.8",
13-
"detritus-client": "^0.17.0-beta.4",
13+
"detritus-client": "^0.17.0-beta.5",
1414
"emoji-aware": "^3.0.5",
1515
"juration": "^0.1.1",
1616
"moment": "^2.29.1",

src/api/endpoints.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ export const Api = Object.freeze({
6363
'/image/create/:height:x:width:/colors/:red:.:green:.:blue:.:format:',
6464
IMAGE_CREATE_TOMBSTONE:
6565
'/image/create/tombstone',
66+
IMAGE_CREATE_WORDCLOUD:
67+
'/image/create/wordcloud',
68+
IMAGE_CREATE_WORDCLOUD_BACKGROUND:
69+
'/image/create/wordcloud/background',
6670

6771
IMAGE_INFORMATION_EXIF:
6872
'/image/information/exif',

src/api/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,14 @@ export async function imageCreateTombstone(
408408
}
409409

410410

411+
export async function imageCreateWordcloud(
412+
context: RequestContext,
413+
options: RestOptions.ImageCreateWordcloud,
414+
) {
415+
return raw.imageCreateWordcloud(context, options);
416+
}
417+
418+
411419
export async function imageInformationExif(
412420
context: RequestContext,
413421
options: RestOptions.ImageBaseOptions,

src/api/raw.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,24 @@ export async function imageCreateTombstone(
732732
}
733733

734734

735+
export async function imageCreateWordcloud(
736+
context: RequestContext,
737+
options: RestOptions.ImageCreateWordcloud,
738+
): Promise<Response> {
739+
const body = {
740+
words: options.words,
741+
};
742+
return request(context, {
743+
dataOnly: false,
744+
body,
745+
route: {
746+
method: HTTPMethods.POST,
747+
path: Api.IMAGE_CREATE_WORDCLOUD,
748+
},
749+
});
750+
}
751+
752+
735753
export async function imageInformationExif(
736754
context: RequestContext,
737755
options: RestOptions.ImageBaseOptions,

src/api/types.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ export namespace RestOptions {
184184
line5?: string,
185185
}
186186

187+
export interface ImageCreateWordcloud {
188+
words: Array<string>,
189+
}
190+
187191
export interface ImageManipulationBlur extends ImageBaseOptions {
188192
scale?: number,
189193
}
@@ -423,14 +427,16 @@ export namespace RestOptions {
423427

424428
export interface UploadCommands {
425429
commands: Array<{
426-
aliases: Array<string>,
427-
args: Array<{aliases: Array<string>, name: string, prefix: string}>,
428-
description: string,
429-
dmable: boolean,
430-
examples: Array<string>,
430+
aliases?: Array<string>,
431+
args?: Array<{aliases: Array<string>, description?: string, name: string, prefix: string}>,
432+
category: string,
433+
description?: string,
434+
dmable?: boolean,
435+
examples?: Array<string>,
436+
id: string,
431437
name: string,
432-
ratelimits: Array<{duration: number, key?: string, limit: number, type: string}>,
433-
type: string,
438+
ratelimits?: Array<{duration: number, key?: string, limit: number, type: string}>,
439+
type: number,
434440
usage: string,
435441
}>,
436442
}

src/commands/interactions/basecommand.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ export class BaseInteractionCommandOptionGroup<ParsedArgsFinished = Interaction.
301301

302302
export class BaseSlashCommand<ParsedArgsFinished = Interaction.ParsedArgs> extends BaseInteractionCommand<ParsedArgsFinished> {
303303
error = 'Slash';
304+
permissionsIgnoreClientOwner = true;
304305
type = ApplicationCommandTypes.CHAT_INPUT;
305306

306307
triggerLoadingAfter = 1000;

src/commands/interactions/context-menu/user/information.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import { BaseContextMenuUserCommand, ContextMenuUserArgs } from '../../basecomma
88
export const COMMAND_NAME = 'Information';
99

1010
export default class InformationCommand extends BaseContextMenuUserCommand {
11+
metadata = {
12+
id: Formatter.Commands.InfoUser.COMMAND_ID,
13+
};
1114
name = COMMAND_NAME;
1215

1316
async run(context: Interaction.InteractionContext, args: ContextMenuUserArgs) {

src/commands/interactions/slash/audio/convert.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export const COMMAND_NAME = 'convert';
99

1010
export class AudioConvertCommand extends BaseInteractionAudioOrVideoCommandOption {
1111
description = 'Convert an Audio or Video File';
12+
metadata = {
13+
id: Formatter.Commands.AudioConvert.COMMAND_ID,
14+
};
1215
name = COMMAND_NAME;
1316

1417
constructor() {

src/commands/interactions/slash/audio/identify.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export const COMMAND_NAME = 'identify';
99

1010
export class AudioIdentifyCommand extends BaseInteractionAudioOrVideoCommandOption {
1111
description = 'Identify a song in an audio or video file';
12+
metadata = {
13+
id: Formatter.Commands.AudioIdentify.COMMAND_ID,
14+
};
1215
name = COMMAND_NAME;
1316

1417
async run(context: Interaction.InteractionContext, args: Formatter.Commands.AudioIdentify.CommandArgs) {

src/commands/interactions/slash/image/background/remove.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ export const COMMAND_NAME = 'remove';
99

1010
export class ImageBackgroundRemoveCommand extends BaseInteractionImageCommandOption {
1111
description = 'Remove an image\'s background';
12+
metadata = {
13+
id: Formatter.Commands.ImageBackgroundRemove.COMMAND_ID,
14+
};
1215
name = COMMAND_NAME;
1316

1417
constructor() {

0 commit comments

Comments
 (0)