Skip to content

Commit 1c0a84f

Browse files
committed
Update Paginator, User and commands
- Update Paginator -> Change `stop` to now delete the message instead of stopping the buttons (also new emoji) - Update `User` -> Add `opted_out_content` (should be `opted_out: {content}`) - Update commands -> Update prune to work in dms - Add Slash Commands -> Added `/privacy` to give a privacy policy -> Added `/settings-user opt-out content` (wip)
1 parent e3239a6 commit 1c0a84f

File tree

24 files changed

+628
-517
lines changed

24 files changed

+628
-517
lines changed

src/api/raw.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ export async function editUser(
320320
const body = {
321321
blocked: options.blocked,
322322
locale: options.locale,
323+
opt_out_content: options.optOutContent,
323324
};
324325
const params = {userId};
325326
return request(context, {

src/api/structures/user.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ const keysUser = new Collections.BaseSet<string>([
1818
NotSoApiKeys.FLAGS,
1919
NotSoApiKeys.ID,
2020
NotSoApiKeys.LOCALE,
21-
NotSoApiKeys.USERNAME,
21+
NotSoApiKeys.OPTED_OUT_CONTENT,
2222
NotSoApiKeys.PREMIUM_TYPE,
23+
NotSoApiKeys.USERNAME,
2324
]);
2425

2526
export class User extends BaseStructure {
@@ -32,8 +33,9 @@ export class User extends BaseStructure {
3233
flags: number = 0;
3334
id: string = '';
3435
locale: GoogleLocales | null = null;
35-
username: string = '';
36+
optedOutContent: string | null = null;
3637
premiumType: UserPremiumTypes = UserPremiumTypes.NONE;
38+
username: string = '';
3739

3840
constructor(data: Structures.BaseStructureData) {
3941
super();

src/api/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export namespace RestOptions {
7979
export interface EditUser {
8080
blocked?: boolean,
8181
locale?: null | string,
82+
optOutContent?: boolean,
8283
}
8384

8485

@@ -1276,10 +1277,11 @@ export namespace RestResponsesRaw {
12761277
blocked: boolean,
12771278
bot: boolean,
12781279
discriminator: string,
1280+
flags: number,
12791281
id: string,
12801282
locale: GoogleLocales | null,
1281-
flags: number,
1282-
username: string,
1283+
opted_out_content: null | string,
12831284
premium_type: number,
1285+
username: string,
12841286
}
12851287
}
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +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-
}
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 & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +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-
}
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+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Interaction } from 'detritus-client';
2+
import { MessageFlags } from 'detritus-client/lib/constants';
3+
4+
import { editOrReply } from '../../../utils';
5+
6+
import { BaseSlashCommand } from '../basecommand';
7+
8+
9+
export const COMMAND_NAME = 'privacy';
10+
11+
export default class PrivacyCommand extends BaseSlashCommand {
12+
description = 'Privacy Policy';
13+
name = COMMAND_NAME;
14+
15+
run(context: Interaction.InteractionContext) {
16+
return editOrReply(context, {
17+
content: '<https://beta.notsobot.com/legal/privacy>',
18+
flags: MessageFlags.EPHEMERAL,
19+
});
20+
}
21+
}

src/commands/interactions/slash/settings-user/index.ts

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

3+
import { SettingsUserOptOutGroupCommand } from './opt-out';
34
import { SettingsUserSetGroupCommand } from './set';
45

56

@@ -10,6 +11,7 @@ export default class SettingsUserGroupCommand extends BaseSlashCommand {
1011
constructor() {
1112
super({
1213
options: [
14+
//new SettingsUserOptOutGroupCommand(),
1315
new SettingsUserSetGroupCommand(),
1416
],
1517
});
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 { SettingsUserOptOutContentCommand } from './opt-out.content';
4+
5+
6+
export class SettingsUserOptOutGroupCommand extends BaseInteractionCommandOptionGroup {
7+
description = '.';
8+
name = 'opt-out';
9+
10+
constructor() {
11+
super({
12+
options: [
13+
new SettingsUserOptOutContentCommand(),
14+
],
15+
});
16+
}
17+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Interaction } from 'detritus-client';
2+
import { MessageFlags } from 'detritus-client/lib/constants';
3+
4+
import { GoogleLocales } from '../../../../../constants';
5+
import { Formatter, Parameters, editOrReply } from '../../../../../utils';
6+
7+
import { BaseInteractionCommandOption } from '../../../basecommand';
8+
9+
10+
export interface CommandArgs {
11+
opt: boolean,
12+
}
13+
14+
export class SettingsUserOptOutContentCommand extends BaseInteractionCommandOption {
15+
description = 'Opt-Out of Message Content Scanning (No longer respond to non-slash commands nor view your media)';
16+
name = 'content';
17+
18+
constructor() {
19+
super({
20+
options: [
21+
{
22+
name: 'opt-out',
23+
description: 'Opt Out',
24+
label: 'opt',
25+
required: true,
26+
type: Boolean,
27+
},
28+
],
29+
});
30+
}
31+
32+
async run(context: Interaction.InteractionContext, args: CommandArgs) {
33+
return editOrReply(context, {
34+
content: '⚠ wip',
35+
flags: MessageFlags.EPHEMERAL,
36+
});
37+
}
38+
}
Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
import { Interaction } from 'detritus-client';
2-
3-
import { Formatter, Parameters, editOrReply } from '../../../../utils';
4-
5-
import { BaseInteractionCommandOption } from '../../basecommand';
6-
7-
8-
export class TagRemoveCommand extends BaseInteractionCommandOption {
9-
description = 'Remove a tag';
10-
metadata = {
11-
id: Formatter.Commands.TagRemove.COMMAND_ID,
12-
};
13-
name = 'remove';
14-
15-
constructor() {
16-
super({
17-
options: [
18-
{
19-
name: 'name',
20-
description: 'Tag\'s Name',
21-
label: 'tag',
22-
required: true,
23-
value: Parameters.NotSoTag,
24-
onAutoComplete: Parameters.AutoComplete.tags,
25-
},
26-
],
27-
});
28-
}
29-
30-
onBeforeRun(context: Interaction.InteractionContext, args: Formatter.Commands.TagRemove.CommandArgsBefore) {
31-
return !!args.tag;
32-
}
33-
34-
onCancelRun(context: Interaction.InteractionContext, args: Formatter.Commands.TagRemove.CommandArgsBefore) {
35-
if (args.tag === false) {
36-
return editOrReply(context, '⚠ Unknown Tag');
37-
}
38-
return super.onCancelRun(context, args);
39-
}
40-
41-
async run(context: Interaction.InteractionContext, args: Formatter.Commands.TagRemove.CommandArgs) {
42-
return Formatter.Commands.TagRemove.createMessage(context, args);
43-
}
44-
}
1+
import { Interaction } from 'detritus-client';
2+
3+
import { Formatter, Parameters, editOrReply } from '../../../../utils';
4+
5+
import { BaseInteractionCommandOption } from '../../basecommand';
6+
7+
8+
export class TagRemoveCommand extends BaseInteractionCommandOption {
9+
description = 'Remove a tag';
10+
metadata = {
11+
id: Formatter.Commands.TagRemove.COMMAND_ID,
12+
};
13+
name = 'remove';
14+
15+
constructor() {
16+
super({
17+
options: [
18+
{
19+
name: 'name',
20+
description: 'Tag\'s Name',
21+
label: 'tag',
22+
required: true,
23+
value: Parameters.NotSoTag,
24+
onAutoComplete: Parameters.AutoComplete.tags,
25+
},
26+
],
27+
});
28+
}
29+
30+
onBeforeRun(context: Interaction.InteractionContext, args: Formatter.Commands.TagRemove.CommandArgsBefore) {
31+
return !!args.tag;
32+
}
33+
34+
onCancelRun(context: Interaction.InteractionContext, args: Formatter.Commands.TagRemove.CommandArgsBefore) {
35+
if (args.tag === false) {
36+
return editOrReply(context, '⚠ Unknown Tag');
37+
}
38+
return super.onCancelRun(context, args);
39+
}
40+
41+
async run(context: Interaction.InteractionContext, args: Formatter.Commands.TagRemove.CommandArgs) {
42+
return Formatter.Commands.TagRemove.createMessage(context, args);
43+
}
44+
}

0 commit comments

Comments
 (0)