Skip to content

Commit 64e4276

Browse files
committed
Add new slash commands, Update some commands
- Update slash media commands to support attachments - Add `/tools qr create` and `/tools qr scan` - Add `/i background remove` - Update google search commands -> Fix locale not being inputted properly - Update `/v convert` -> Add `noaudio` parameter
1 parent 7adbdc4 commit 64e4276

Some content is hidden

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

41 files changed

+312
-43
lines changed

src/api/raw.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,6 +2135,7 @@ export async function videoToolsConvert(
21352135
options: RestOptions.VideoToolsConvertOptions,
21362136
): Promise<Response> {
21372137
const query = {
2138+
remove_audio: options.removeAudio,
21382139
to: options.to,
21392140
url: options.url,
21402141
};

src/api/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ export namespace RestOptions {
426426
}
427427

428428
export interface VideoToolsConvertOptions extends VideoBaseOptions {
429+
removeAudio?: boolean,
429430
to: string,
430431
}
431432
}

src/commands/interactions/basecommand.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ import { EmbedColors, PermissionsText } from '../../constants';
1414
import { DefaultParameters, Parameters, editOrReply } from '../../utils';
1515

1616

17+
export interface InteractionCommandMetadata {
18+
id: string,
19+
};
1720

1821
export class BaseInteractionCommand<ParsedArgsFinished = Interaction.ParsedArgs> extends Interaction.InteractionCommand<ParsedArgsFinished> {
1922
error = 'Command';
@@ -192,6 +195,7 @@ export class BaseInteractionImageCommandOption<ParsedArgsFinished = Interaction.
192195
options: [
193196
...(data.options || []),
194197
{name: 'image', description: 'Emoji/Image URL/User', label: 'url', default: DefaultParameters.lastImageUrl, value: Parameters.lastImageUrl},
198+
{name: 'file', description: 'Image File', type: ApplicationCommandOptionTypes.ATTACHMENT},
195199
],
196200
});
197201
}
@@ -221,6 +225,7 @@ export class BaseInteractionVideoCommandOption<ParsedArgsFinished = Interaction.
221225
options: [
222226
...(data.options || []),
223227
{name: 'video', description: 'Emoji/Media URL/User', label: 'url', default: DefaultParameters.lastVideoUrl, value: Parameters.lastVideoUrl},
228+
{name: 'file', description: 'Video File', type: ApplicationCommandOptionTypes.ATTACHMENT},
224229
],
225230
});
226231
}

src/commands/interactions/context-menu/message/translate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface TranslateCommandArgs extends ContextMenuMessageArgs {
1111
url?: string | null,
1212
}
1313

14-
export const COMMAND_NAME = 'Translate';
14+
export const COMMAND_NAME = 'Translate (w/ OCR)';
1515

1616
export default class TranslateCommand extends BaseContextMenuMessageCommand {
1717
name = COMMAND_NAME;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { BaseInteractionCommandOptionGroup } from '../../../basecommand';
2+
3+
import { ImageBackgroundRemoveCommand } from './remove';
4+
5+
6+
export class ImageBackgroundGroupCommand extends BaseInteractionCommandOptionGroup {
7+
description = '.';
8+
name = 'background';
9+
10+
constructor() {
11+
super({
12+
options: [
13+
new ImageBackgroundRemoveCommand(),
14+
],
15+
});
16+
}
17+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Interaction } from 'detritus-client';
2+
3+
import { Formatter } from '../../../../../utils';
4+
5+
import { BaseInteractionImageCommandOption } from '../../../basecommand';
6+
7+
8+
export const COMMAND_NAME = 'remove';
9+
10+
export class ImageBackgroundRemoveCommand extends BaseInteractionImageCommandOption {
11+
description = 'Remove an image\'s background';
12+
name = COMMAND_NAME;
13+
14+
constructor() {
15+
super({
16+
options: [
17+
{
18+
name: 'model',
19+
description: 'Background Removal Model',
20+
choices: Formatter.Commands.ImageBackgroundRemove.SLASH_CHOICES_MODEL,
21+
default: Formatter.Commands.ImageBackgroundRemove.DEFAULT_MODEL,
22+
},
23+
],
24+
});
25+
}
26+
27+
async run(context: Interaction.InteractionContext, args: Formatter.Commands.ImageBackgroundRemove.CommandArgs) {
28+
return Formatter.Commands.ImageBackgroundRemove.createMessage(context, args);
29+
}
30+
}

src/commands/interactions/slash/image/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ImageFlopCommand } from './flop';
1212
import { ImageInvertCommand } from './invert';
1313
import { ImageMemeCommand } from './meme';
1414

15+
import { ImageBackgroundGroupCommand } from './background';
1516
import { ImageGifGroupCommand } from './gif';
1617
import { ImageOverlayGroupCommand } from './overlay';
1718
import { ImageToolsGroupCommand } from './tools';
@@ -25,6 +26,7 @@ export default class ImageGroupCommand extends BaseSlashCommand {
2526
super({
2627
permissions: [Permissions.ATTACH_FILES],
2728
options: [
29+
new ImageBackgroundGroupCommand(),
2830
new ImageBlurCommand(),
2931
new ImageBlurpleCommand(),
3032
new ImageCircleCommand(),

src/commands/interactions/slash/tag/info.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ export interface CommandArgsBefore {
1212

1313
export class TagInfoCommand extends BaseInteractionCommandOption {
1414
description = 'View a Tag\'s Information';
15+
metadata = {
16+
id: Formatter.Commands.TagInfo.COMMAND_ID,
17+
};
1518
name = 'info';
1619

1720
constructor() {

src/commands/interactions/slash/tag/list/server.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import { BaseInteractionCommandOption } from '../../../basecommand';
88

99
export class TagListServerCommand extends BaseInteractionCommandOption {
1010
description = 'List the Server\'s Tags';
11+
metadata = {
12+
id: Formatter.Commands.TagListServer.COMMAND_ID,
13+
};
1114
name = 'server';
1215

1316
constructor() {

src/commands/interactions/slash/tag/list/user.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export interface CommandArgs {
1313

1414
export class TagListUserCommand extends BaseInteractionCommandOption {
1515
description = 'List all of a User\'s Tags';
16+
metadata = {
17+
id: Formatter.Commands.TagListUser.COMMAND_ID,
18+
};
1619
name = 'user';
1720

1821
constructor() {

0 commit comments

Comments
 (0)