Skip to content

Commit b26cfea

Browse files
committed
Added .globe and .glitch gif as well as {jsonify:TEXT} in tags
1 parent a86c393 commit b26cfea

File tree

12 files changed

+131
-5
lines changed

12 files changed

+131
-5
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"dependencies": {
1111
"@sentry/node": "^6.4.1",
1212
"chrono-node": "^2.3.8",
13-
"detritus-client": "^0.17.0-beta.7",
13+
"detritus-client": "^0.17.0-beta.8",
14+
"detritus-client-rest": "^0.11.0-beta.3",
1415
"emoji-aware": "^3.0.5",
1516
"juration": "^0.1.1",
1617
"moment": "^2.29.1",

src/api/endpoints.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export const Api = Object.freeze({
9393
'/image/manipulation/flop',
9494
IMAGE_MANIPULATION_GLITCH:
9595
'/image/manipulation/glitch',
96+
IMAGE_MANIPULATION_GLITCH_GIF:
97+
'/image/manipulation/glitch/gif',
9698
IMAGE_MANIPULATION_GLOBE:
9799
'/image/manipulation/globe',
98100
IMAGE_MANIPULATION_GOLD:

src/api/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,14 @@ export async function imageManipulationGlitch(
512512
}
513513

514514

515+
export async function imageManipulationGlitchGif(
516+
context: RequestContext,
517+
options: RestOptions.ImageManipulationGlitch,
518+
) {
519+
return raw.imageManipulationGlitchGif(context, options);
520+
}
521+
522+
515523
export async function imageManipulationGlobe(
516524
context: RequestContext,
517525
options: RestOptions.ImageBaseOptions,

src/api/raw.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,27 @@ export async function imageManipulationGlitch(
978978
}
979979

980980

981+
export async function imageManipulationGlitchGif(
982+
context: RequestContext,
983+
options: RestOptions.ImageManipulationGlitch,
984+
): Promise<Response> {
985+
const query = {
986+
amount: options.amount,
987+
iterations: options.iterations,
988+
seed: options.seed,
989+
url: options.url,
990+
};
991+
return request(context, {
992+
dataOnly: false,
993+
query,
994+
route: {
995+
method: HTTPMethods.POST,
996+
path: Api.IMAGE_MANIPULATION_GLITCH_GIF,
997+
},
998+
});
999+
}
1000+
1001+
9811002
export async function imageManipulationGlobe(
9821003
context: RequestContext,
9831004
options: RestOptions.ImageBaseOptions,
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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 = 'glitch';
9+
10+
export class ImageGifGlitchCommand extends BaseInteractionImageCommandOption {
11+
description = 'Glitch an Image/Gif';
12+
metadata = {
13+
id: Formatter.Commands.ImageManipulationGlitchGif.COMMAND_ID,
14+
};
15+
name = COMMAND_NAME;
16+
17+
async run(context: Interaction.InteractionContext, args: Formatter.Commands.ImageManipulationGlitchGif.CommandArgs) {
18+
return Formatter.Commands.ImageManipulationGlitchGif.createMessage(context, args);
19+
}
20+
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { BaseInteractionCommandOptionGroup } from '../../../basecommand';
22

3-
import { ImageGMagikCommand } from './magik';
3+
import { ImageGifGlitchCommand } from './glitch';
4+
import { ImageGifMagikCommand } from './magik';
45
import { ImageGifReverseCommand } from './reverse';
56
import { ImageGifSeeSawCommand } from './seesaw';
67
import { ImageGifSpeedCommand } from './speed';
@@ -13,7 +14,8 @@ export class ImageGifGroupCommand extends BaseInteractionCommandOptionGroup {
1314
constructor() {
1415
super({
1516
options: [
16-
new ImageGMagikCommand(),
17+
new ImageGifGlitchCommand(),
18+
new ImageGifMagikCommand(),
1719
new ImageGifReverseCommand(),
1820
new ImageGifSeeSawCommand(),
1921
new ImageGifSpeedCommand(),

src/commands/interactions/slash/image/gif/magik.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { BaseInteractionImageCommandOption } from '../../../basecommand';
77

88
export const COMMAND_NAME = 'magik';
99

10-
export class ImageGMagikCommand extends BaseInteractionImageCommandOption {
10+
export class ImageGifMagikCommand extends BaseInteractionImageCommandOption {
1111
description = 'Moving Magikfy an Image/Gif';
1212
metadata = {
1313
id: Formatter.Commands.ImageMagikGif.COMMAND_ID,
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { Command, CommandClient } from 'detritus-client';
2+
3+
import { CommandCategories } from '../../../constants';
4+
import { Formatter } from '../../../utils';
5+
6+
import { BaseImageCommand } from '../basecommand';
7+
8+
9+
export const COMMAND_NAME = 'glitch gif';
10+
11+
export default class GlitchGifCommand extends BaseImageCommand {
12+
constructor(client: CommandClient) {
13+
super(client, {
14+
name: COMMAND_NAME,
15+
16+
args: [
17+
{name: 'amount', type: Number},
18+
{name: 'iterations', type: Number},
19+
{name: 'seed', type: Number},
20+
//{name: 'type'}, // theres glitch2, but maybe get rid of it?
21+
],
22+
metadata: {
23+
category: CommandCategories.IMAGE,
24+
description: 'Glitch an Image/Gif',
25+
examples: [
26+
COMMAND_NAME,
27+
`${COMMAND_NAME} notsobot`,
28+
`${COMMAND_NAME} notsobot -seed 68`,
29+
],
30+
id: Formatter.Commands.ImageManipulationGlitchGif.COMMAND_ID,
31+
usage: '?<emoji,user:id|mention|name,url> (-amount <number>) (-iterations <number>) (-seed <number>)', // (-type <glitch-type>)
32+
},
33+
});
34+
}
35+
36+
async run(context: Command.Context, args: Formatter.Commands.ImageManipulationGlitchGif.CommandArgs) {
37+
return Formatter.Commands.ImageManipulationGlitchGif.createMessage(context, args);
38+
}
39+
}

src/commands/prefixed/image/glitch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { BaseImageCommand } from '../basecommand';
88

99
export const COMMAND_NAME = 'glitch';
1010

11-
export default class GlitchCommand extends BaseImageCommand<Formatter.Commands.ImageGlitch.CommandArgs> {
11+
export default class GlitchCommand extends BaseImageCommand {
1212
constructor(client: CommandClient) {
1313
super(client, {
1414
name: COMMAND_NAME,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { Command, Interaction } from 'detritus-client';
2+
3+
import { imageManipulationGlitchGif } from '../../../api';
4+
import { imageReply } from '../../../utils';
5+
6+
7+
export const COMMAND_ID = 'image.manipulation.glitch';
8+
9+
export interface CommandArgs {
10+
amount?: number,
11+
iterations?: number,
12+
seed?: number,
13+
url: string,
14+
}
15+
16+
export async function createMessage(
17+
context: Command.Context | Interaction.InteractionContext,
18+
args: CommandArgs,
19+
) {
20+
const response = await imageManipulationGlitchGif(context, args);
21+
return imageReply(context, response);
22+
}

0 commit comments

Comments
 (0)