Skip to content

Commit 2b3ed43

Browse files
committed
Added .object remove and /i objects remove
Fixed minor bug with background remove prefixed command class name
1 parent 1a4fa21 commit 2b3ed43

File tree

17 files changed

+391
-189
lines changed

17 files changed

+391
-189
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
2-
/lib
2+
/lib
3+
config.json
File renamed without changes.

package-lock.json

Lines changed: 109 additions & 185 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
"dependencies": {
1111
"@sentry/node": "^6.4.1",
1212
"chrono-node": "^2.3.8",
13-
"detritus-client": "^0.17.0-beta.10",
14-
"detritus-rest": "^0.9.0-beta.4",
13+
"detritus-client": "^0.17.0-beta.11",
1514
"emoji-aware": "^3.0.5",
1615
"juration": "^0.1.1",
1716
"moment": "^2.29.1",
1817
"moment-duration-format": "^2.3.2",
1918
"moment-timezone": "^0.5.32",
2019
"redis": "^3.1.2",
20+
"typescript": "^4.6.4",
2121
"undici": "^5.1.1"
2222
},
2323
"devDependencies": {

src/api/endpoints.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ export const Api = Object.freeze({
173173

174174
IMAGE_TOOLS_BACKGROUND_REMOVE:
175175
'/image/tools/background/remove',
176+
IMAGE_TOOLS_OBJECT_REMOVE:
177+
'/image/tools/object/remove',
176178
IMAGE_TOOLS_CONVERT:
177179
'/image/tools/convert',
178180
IMAGE_TOOLS_CROP:

src/api/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,13 @@ export async function imageToolsBackgroundRemove(
807807
return raw.imageToolsBackgroundRemove(context, options);
808808
}
809809

810+
export async function imageToolsObjectRemove(
811+
context: RequestContext,
812+
options: RestOptions.ImageObjectRemoveOptions,
813+
) {
814+
return raw.imageToolsObjectRemove(context, options);
815+
}
816+
810817

811818
export async function imageToolsConvert(
812819
context: RequestContext,

src/api/raw.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,6 +1680,25 @@ export async function imageToolsBackgroundRemove(
16801680
}
16811681

16821682

1683+
export async function imageToolsObjectRemove(
1684+
context: RequestContext,
1685+
options: RestOptions.ImageObjectRemoveOptions,
1686+
): Promise<Response> {
1687+
const query = {
1688+
label: options.object,
1689+
url: options.url,
1690+
};
1691+
return request(context, {
1692+
dataOnly: false,
1693+
query,
1694+
route: {
1695+
method: HTTPMethods.POST,
1696+
path: Api.IMAGE_TOOLS_OBJECT_REMOVE,
1697+
},
1698+
});
1699+
}
1700+
1701+
16831702
export async function imageToolsConvert(
16841703
context: RequestContext,
16851704
options: RestOptions.ImageToolsConvert,

src/api/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ export namespace RestOptions {
177177
model?: string,
178178
}
179179

180+
export interface ImageObjectRemoveOptions extends ImageBaseOptions {
181+
object?: string,
182+
}
183+
180184
export interface ImageCreateRetrowave {
181185
background?: number,
182186
line1?: string,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ImageMemeCommand } from './meme';
1010
import { ImageSpinCommand } from './spin';
1111

1212
import { ImageBackgroundGroupCommand } from './background';
13+
import { ImageObjectGroupCommand } from './object';
1314
import { ImageFunGroupCommand } from './fun';
1415
import { ImageGifGroupCommand } from './gif';
1516
import { ImageOverlayGroupCommand } from './overlay';
@@ -33,6 +34,7 @@ export default class ImageGroupCommand extends BaseSlashCommand {
3334
new ImageGifGroupCommand(),
3435
new ImageJPEGCommand(),
3536
new ImageMemeCommand(),
37+
new ImageObjectGroupCommand(),
3638
new ImageOverlayGroupCommand(),
3739
new ImageSpinCommand(),
3840
new ImageTintGroupCommand(),
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 { ImageObjectRemoveCommand } from './remove';
4+
5+
6+
export class ImageObjectGroupCommand extends BaseInteractionCommandOptionGroup {
7+
description = '.';
8+
name = 'objects';
9+
10+
constructor() {
11+
super({
12+
options: [
13+
new ImageObjectRemoveCommand(),
14+
],
15+
});
16+
}
17+
}

0 commit comments

Comments
 (0)