aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.eslintrc.cjs5
-rw-r--r--package.json8
-rw-r--r--src/commands/config/config.ts2
-rw-r--r--src/commands/config/features.ts29
-rw-r--r--src/commands/dev/test.ts18
-rw-r--r--src/commands/info/help.ts6
-rw-r--r--src/commands/info/links.ts6
-rw-r--r--src/lib/common/AutoMod.ts29
-rw-r--r--src/lib/common/ButtonPaginator.ts55
-rw-r--r--src/lib/common/ConfirmationPrompt.ts4
-rw-r--r--src/lib/common/DeleteButton.ts11
-rw-r--r--src/lib/common/util/Moderation.ts11
-rw-r--r--src/lib/extensions/discord-akairo/BushClient.ts34
-rw-r--r--src/lib/models/instance/Guild.ts83
-rw-r--r--src/listeners/ws/INTERACTION_CREATE.ts25
-rw-r--r--yarn.lock56
16 files changed, 159 insertions, 223 deletions
diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index c83ce2e..1da6f41 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -74,11 +74,6 @@ module.exports = {
allowTypeImports: true
},
{
- name: 'discord-api-types-next',
- message: 'Please use discord-api-types-next/v9 instead.',
- allowTypeImports: true
- },
- {
name: 'console',
importNames: ['assert'],
message: 'Import from the assert module instead.'
diff --git a/package.json b/package.json
index b39aa04..41eb18e 100644
--- a/package.json
+++ b/package.json
@@ -60,15 +60,14 @@
"@notenoughupdates/humanize-duration": "^4.0.1",
"@notenoughupdates/simplify-number": "^1.0.1",
"@notenoughupdates/wolfram-alpha-api": "^1.0.1",
- "@sentry/integrations": "^6.17.9",
- "@sentry/node": "^6.17.9",
- "@sentry/tracing": "^6.17.9",
+ "@sentry/integrations": "^6.18.0",
+ "@sentry/node": "^6.18.0",
+ "@sentry/tracing": "^6.18.0",
"canvas": "^2.9.0",
"chalk": "^5.0.0",
"deep-lock": "^1.0.0",
"discord-akairo": "npm:@notenoughupdates/discord-akairo@dev",
"discord-api-types": "0.27.3",
- "discord-api-types-next": "npm:discord-api-types@next",
"discord.js": "npm:@notenoughupdates/discord.js@dev",
"fuse.js": "^6.5.3",
"googleapis": "^95.0.0",
@@ -94,7 +93,6 @@
"@types/eslint": "^8.4.1",
"@types/express": "^4.17.13",
"@types/lodash": "^4.14.179",
- "@types/lodash.snakecase": "^4.1.6",
"@types/node": "^17.0.21",
"@types/node-os-utils": "^1.2.0",
"@types/numeral": "^2.0.2",
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index f860b30..6cb493d 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -358,7 +358,7 @@ export default class ConfigCommand extends BushCommand {
};
const components = new ActionRow().addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId('command_settingsBack').setLabel('Back')
+ new ButtonComponent({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' })
);
settingsEmbed.setDescription(
`${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}`
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index c9aebd3..c022a3a 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -13,7 +13,6 @@ import {
Embed,
PermissionFlagsBits,
SelectMenuComponent,
- SelectMenuOption,
type Message,
type SelectMenuInteraction
} from 'discord.js';
@@ -85,21 +84,19 @@ export default class FeaturesCommand extends BushCommand {
public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) {
return new ActionRow().addComponents(
- new SelectMenuComponent()
- .setCustomId('command_selectFeature')
- .setDisabled(disable)
- .setMaxValues(1)
- .setMinValues(1)
- .setOptions(
- ...guildFeatures
- .filter((f) => guildFeaturesObj[f].notConfigurable !== false)
- .map((f) =>
- new SelectMenuOption()
- .setLabel(guildFeaturesObj[f].name)
- .setValue(f)
- .setDescription(guildFeaturesObj[f].description)
- )
- )
+ new SelectMenuComponent({
+ customId: 'command_selectFeature',
+ disabled: disable,
+ maxValues: 1,
+ minValues: 1,
+ options: guildFeatures
+ .filter((f) => !guildFeaturesObj[f].hidden)
+ .map((f) => ({
+ label: guildFeaturesObj[f].name,
+ value: f,
+ description: guildFeaturesObj[f].description
+ }))
+ })
);
}
}
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 7bab0a1..8c76ded 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -54,11 +54,11 @@ export default class TestCommand extends BushCommand {
if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) {
const ButtonRow = new ActionRow().addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId('primaryButton').setLabel('Primary'),
- new ButtonComponent().setStyle(ButtonStyle.Secondary).setCustomId('secondaryButton').setLabel('Secondary'),
- new ButtonComponent().setStyle(ButtonStyle.Success).setCustomId('successButton').setLabel('Success'),
- new ButtonComponent().setStyle(ButtonStyle.Danger).setCustomId('dangerButton').setLabel('Danger'),
- new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Link').setURL('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
+ new ButtonComponent({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }),
+ new ButtonComponent({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }),
+ new ButtonComponent({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }),
+ new ButtonComponent({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }),
+ new ButtonComponent({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' })
);
return await message.util.reply({ content: 'buttons', components: [ButtonRow] });
} else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) {
@@ -77,7 +77,7 @@ export default class TestCommand extends BushCommand {
.setTitle('Title');
const buttonRow = new ActionRow().addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Link').setURL('https://google.com/')
+ new ButtonComponent({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' })
);
return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] });
} else if (['lots of buttons'].includes(args?.feature?.toLowerCase())) {
@@ -86,7 +86,7 @@ export default class TestCommand extends BushCommand {
const row = new ActionRow();
for (let b = 1; b <= 5; b++) {
const id = (a + 5 * (b - 1)).toString();
- const button = new ButtonComponent().setStyle(ButtonStyle.Primary).setCustomId(id).setLabel(id);
+ const button = new ButtonComponent({ style: ButtonStyle.Primary, customId: id, label: id });
row.addComponents(button);
}
ButtonRows.push(row);
@@ -118,7 +118,7 @@ export default class TestCommand extends BushCommand {
const row = new ActionRow();
for (let b = 1; b <= 5; b++) {
const id = (a + 5 * (b - 1)).toString();
- const button = new ButtonComponent().setStyle(ButtonStyle.Secondary).setCustomId(id).setLabel(id);
+ const button = new ButtonComponent({ style: ButtonStyle.Secondary, customId: id, label: id });
row.addComponents(button);
}
ButtonRows.push(row);
@@ -151,7 +151,7 @@ export default class TestCommand extends BushCommand {
content: 'Click for modal',
components: [
new ActionRow().addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Primary).setLabel('Modal').setCustomId('test;modal')
+ new ButtonComponent({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' })
)
]
});
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 2383566..15c447a 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -143,15 +143,15 @@ export default class HelpCommand extends BushCommand {
const row = new ActionRow();
if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) {
- row.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Invite Me').setURL(util.invite));
+ row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite }));
}
if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) {
row.addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Support Server').setURL(client.config.supportGuild.invite)
+ new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite })
);
}
if (packageDotJSON?.repository)
- row.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('GitHub').setURL(packageDotJSON.repository));
+ row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }));
else void message.channel?.send('Error importing package.json, please report this to my developer.');
return row;
diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts
index d91f1e7..e14195e 100644
--- a/src/commands/info/links.ts
+++ b/src/commands/info/links.ts
@@ -22,11 +22,11 @@ export default class LinksCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage) {
const buttonRow = new ActionRow();
if (!client.config.isDevelopment || message.author.isOwner()) {
- buttonRow.addComponents(new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Invite Me').setURL(util.invite));
+ buttonRow.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite }));
}
buttonRow.addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('Support Server').setURL(client.config.supportGuild.invite),
- new ButtonComponent().setStyle(ButtonStyle.Link).setLabel('GitHub').setURL(packageDotJSON.repository)
+ new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }),
+ new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })
);
return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] });
}
diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts
index d043ef0..93d2f8f 100644
--- a/src/lib/common/AutoMod.ts
+++ b/src/lib/common/AutoMod.ts
@@ -162,17 +162,15 @@ export class AutoMod {
.setColor(color)
.setTimestamp()
],
- components:
- Severity.TEMP_MUTE >= 2
- ? [
- new ActionRow().addComponents(
- new ButtonComponent()
- .setStyle(ButtonStyle.Danger)
- .setLabel('Ban User')
- .setCustomId(`automod;ban;${this.message.author.id};everyone mention and scam phrase`)
- )
- ]
- : undefined
+ components: [
+ new ActionRow().addComponents(
+ new ButtonComponent({
+ style: ButtonStyle.Danger,
+ label: 'Ban User',
+ customId: `automod;ban;${this.message.author.id};everyone mention and scam phrase`
+ })
+ )
+ ]
});
}
}
@@ -334,10 +332,11 @@ export class AutoMod {
highestOffence.severity >= 2
? [
new ActionRow().addComponents(
- new ButtonComponent()
- .setStyle(ButtonStyle.Danger)
- .setLabel('Ban User')
- .setCustomId(`automod;ban;${this.message.author.id};${highestOffence.reason}`)
+ new ButtonComponent({
+ style: ButtonStyle.Danger,
+ label: 'Ban User',
+ customId: `automod;ban;${this.message.author.id};${highestOffence.reason}`
+ })
)
]
: undefined
diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts
index a289855..15c07fa 100644
--- a/src/lib/common/ButtonPaginator.ts
+++ b/src/lib/common/ButtonPaginator.ts
@@ -172,31 +172,36 @@ export class ButtonPaginator {
*/
protected getPaginationRow(disableAll = false): ActionRow<ActionRowComponent> {
return new ActionRow().addComponents(
- new ButtonComponent()
- .setStyle(ButtonStyle.Primary)
- .setCustomId('paginate_beginning')
- .setEmoji(PaginateEmojis.BEGINNING)
- .setDisabled(disableAll || this.curPage === 0),
- new ButtonComponent()
- .setStyle(ButtonStyle.Primary)
- .setCustomId('paginate_back')
- .setEmoji(PaginateEmojis.BACK)
- .setDisabled(disableAll || this.curPage === 0),
- new ButtonComponent()
- .setStyle(ButtonStyle.Primary)
- .setCustomId('paginate_stop')
- .setEmoji(PaginateEmojis.STOP)
- .setDisabled(disableAll),
- new ButtonComponent()
- .setStyle(ButtonStyle.Primary)
- .setCustomId('paginate_next')
- .setEmoji(PaginateEmojis.FORWARD)
- .setDisabled(disableAll || this.curPage === this.embeds.length - 1),
- new ButtonComponent()
- .setStyle(ButtonStyle.Primary)
- .setCustomId('paginate_end')
- .setEmoji(PaginateEmojis.END)
- .setDisabled(disableAll || this.curPage === this.embeds.length - 1)
+ new ButtonComponent({
+ style: ButtonStyle.Primary,
+ customId: 'paginate_beginning',
+ emoji: PaginateEmojis.BEGINNING,
+ disabled: disableAll || this.curPage === 0
+ }),
+ new ButtonComponent({
+ style: ButtonStyle.Primary,
+ customId: 'paginate_back',
+ emoji: PaginateEmojis.BACK,
+ disabled: disableAll || this.curPage === 0
+ }),
+ new ButtonComponent({
+ style: ButtonStyle.Primary,
+ customId: 'paginate_stop',
+ emoji: PaginateEmojis.STOP,
+ disabled: disableAll
+ }),
+ new ButtonComponent({
+ style: ButtonStyle.Primary,
+ customId: 'paginate_next',
+ emoji: PaginateEmojis.FORWARD,
+ disabled: disableAll || this.curPage === this.numPages - 1
+ }),
+ new ButtonComponent({
+ style: ButtonStyle.Primary,
+ customId: 'paginate_end',
+ emoji: PaginateEmojis.END,
+ disabled: disableAll || this.curPage === this.numPages - 1
+ })
);
}
diff --git a/src/lib/common/ConfirmationPrompt.ts b/src/lib/common/ConfirmationPrompt.ts
index b775640..4ff00ce 100644
--- a/src/lib/common/ConfirmationPrompt.ts
+++ b/src/lib/common/ConfirmationPrompt.ts
@@ -30,8 +30,8 @@ export class ConfirmationPrompt {
protected async send(): Promise<boolean> {
this.messageOptions.components = [
new ActionRow().addComponents(
- new ButtonComponent().setStyle(ButtonStyle.Success).setCustomId('confirmationPrompt_confirm').setLabel('Yes'),
- new ButtonComponent().setStyle(ButtonStyle.Danger).setCustomId('confirmationPrompt_cancel').setLabel('No')
+ new ButtonComponent({ style: ButtonStyle.Success, customId: 'confirmationPrompt_confirm', label: 'Yes' }),
+ new ButtonComponent({ style: ButtonStyle.Danger, customId: 'confirmationPrompt_cancel', label: 'No' })
)
];
diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts
index cf3b416..0a9fd79 100644
--- a/src/lib/common/DeleteButton.ts
+++ b/src/lib/common/DeleteButton.ts
@@ -67,11 +67,12 @@ export class DeleteButton {
protected updateComponents(edit = false, disable = false): void {
this.messageOptions.components = [
new ActionRow().addComponents(
- new ButtonComponent()
- .setStyle(ButtonStyle.Primary)
- .setCustomId('paginate__stop')
- .setEmoji(PaginateEmojis.STOP)
- .setDisabled(disable)
+ new ButtonComponent({
+ style: ButtonStyle.Primary,
+ customId: 'paginate__stop',
+ emoji: PaginateEmojis.STOP,
+ disabled: disable
+ })
)
];
if (edit) {
diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts
index 365dbd5..afe220c 100644
--- a/src/lib/common/util/Moderation.ts
+++ b/src/lib/common/util/Moderation.ts
@@ -11,7 +11,7 @@ import {
type ModLogType
} from '#lib';
import assert from 'assert';
-import { ActionRow, ButtonComponent, ButtonStyle, ComponentType, Embed, PermissionFlagsBits, type Snowflake } from 'discord.js';
+import { ActionRow, ButtonComponent, ButtonStyle, Embed, PermissionFlagsBits, type Snowflake } from 'discord.js';
enum punishMap {
'warned' = 'warn',
@@ -289,13 +289,12 @@ export class Moderation {
new ActionRow({
components: [
new ButtonComponent({
- custom_id: `appeal;${this.punishmentToPresentTense(options.punishment)};${
- options.guild.id
- };${client.users.resolveId(options.user)};${options.modlog}`,
+ customId: `appeal;${this.punishmentToPresentTense(options.punishment)};${options.guild.id};${client.users.resolveId(
+ options.user
+ )};${options.modlog}`,
style: ButtonStyle.Primary,
- type: ComponentType.Button,
label: 'Appeal'
- })
+ }).toJSON()
]
})
];
diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts
index fa6dc53..1a748ed 100644
--- a/src/lib/extensions/discord-akairo/BushClient.ts
+++ b/src/lib/extensions/discord-akairo/BushClient.ts
@@ -10,7 +10,7 @@ import {
roleWithDuration,
snowflake
} from '#args';
-import {
+import type {
BushBaseGuildEmojiManager,
BushChannelManager,
BushClientEvents,
@@ -23,6 +23,7 @@ import {
import { patch, type PatchedElements } from '@notenoughupdates/events-intercept';
import * as Sentry from '@sentry/node';
import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo';
+import { GatewayIntentBits } from 'discord-api-types/v9';
import {
ActivityType,
Options,
@@ -42,7 +43,6 @@ import {
} from 'discord.js';
import EventEmitter from 'events';
import { google } from 'googleapis';
-import snakeCase from 'lodash.snakecase';
import path from 'path';
import readline from 'readline';
import type { Options as SequelizeOptions, Sequelize as SequelizeType } from 'sequelize';
@@ -213,9 +213,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re
allowedMentions: AllowedMentions.users(), // No everyone or role mentions by default
makeCache: Options.cacheWithLimits({}),
failIfNotExists: false,
- rest: { api: 'https://canary.discord.com/api' },
- // todo: remove this when https://github.com/discordjs/discord.js/pull/7497 is merged
- jsonTransformer
+ rest: { api: 'https://canary.discord.com/api' }
});
patch(this);
@@ -527,29 +525,3 @@ export interface BushStats {
*/
commandsUsed: bigint;
}
-
-// exported as const enum from discord-api-types
-enum GatewayIntentBits {
- Guilds = 1,
- GuildMembers = 2,
- GuildBans = 4,
- GuildEmojisAndStickers = 8,
- GuildIntegrations = 16,
- GuildWebhooks = 32,
- GuildInvites = 64,
- GuildVoiceStates = 128,
- GuildPresences = 256,
- GuildMessages = 512,
- GuildMessageReactions = 1024,
- GuildMessageTyping = 2048,
- DirectMessages = 4096,
- DirectMessageReactions = 8192,
- DirectMessageTyping = 16384,
- GuildScheduledEvents = 65536
-}
-
-function jsonTransformer(obj: any): any {
- if (typeof obj !== 'object' || !obj) return obj;
- if (Array.isArray(obj)) return obj.map(jsonTransformer);
- return Object.fromEntries(Object.entries(obj).map(([key, value]) => [snakeCase(key), jsonTransformer(value)]));
-}
diff --git a/src/lib/models/instance/Guild.ts b/src/lib/models/instance/Guild.ts
index 7fe7ac1..5fb507a 100644
--- a/src/lib/models/instance/Guild.ts
+++ b/src/lib/models/instance/Guild.ts
@@ -311,77 +311,81 @@ interface GuildFeature {
name: string;
description: string;
default: boolean;
- notConfigurable?: boolean;
+ hidden: boolean;
}
-const asGuildFeature = <T>(gf: { [K in keyof T]: GuildFeature }) => gf;
+
+type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
+
+const asGuildFeature = <T>(gf: { [K in keyof T]: PartialBy<GuildFeature, 'hidden' | 'default'> }): {
+ [K in keyof T]: GuildFeature;
+} => {
+ for (const key in gf) {
+ gf[key].hidden ??= false;
+ gf[key].default ??= false;
+ }
+ return gf as { [K in keyof T]: GuildFeature };
+};
export const guildFeaturesObj = asGuildFeature({
automod: {
name: 'Automod',
- description: 'Deletes offensive content as well as phishing links.',
- default: false
+ description: 'Deletes offensive content as well as phishing links.'
},
excludeDefaultAutomod: {
name: 'Exclude Default Automod',
- description: 'Opt out of using the default automod options.',
- default: false
+ description: 'Opt out of using the default automod options.'
},
excludeAutomodScamLinks: {
name: 'Exclude Automod Scam Links',
- description: 'Opt out of having automod delete scam links.',
- default: false
+ description: 'Opt out of having automod delete scam links.'
},
delScamMentions: {
name: 'Delete Scam Mentions',
- description: 'Deletes messages with @everyone and @here mentions that have common scam phrases.',
- default: false
+ description: 'Deletes messages with @everyone and @here mentions that have common scam phrases.'
+ },
+ blacklistedFile: {
+ name: 'Blacklisted File',
+ description: 'Automatically deletes malicious files.'
},
autoPublish: {
name: 'Auto Publish',
- description: 'Publishes messages in configured announcement channels.',
- default: false
+ description: 'Publishes messages in configured announcement channels.'
},
// todo implement a better auto thread system
autoThread: {
name: 'Auto Thread',
description: 'Creates a new thread for messages in configured channels.',
- default: false,
- notConfigurable: true
+ hidden: true
},
- blacklistedFile: {
- name: 'Blacklisted File',
- description: 'Automatically deletes malicious files.',
- default: false
+ perspectiveApi: {
+ name: 'Perspective API',
+ description: 'Use the Perspective API to detect toxicity.',
+ hidden: true
},
boosterMessageReact: {
name: 'Booster Message React',
- description: 'Reacts to booster messages with the boost emoji.',
- default: false
+ description: 'Reacts to booster messages with the boost emoji.'
},
leveling: {
name: 'Leveling',
- description: "Tracks users' messages and assigns them xp.",
- default: false
+ description: "Tracks users' messages and assigns them xp."
+ },
+ sendLevelUpMessages: {
+ name: 'Send Level Up Messages',
+ description: 'Send a message when a user levels up.',
+ default: true
},
stickyRoles: {
name: 'Sticky Roles',
- description: 'Restores past roles to a user when they rejoin.',
- default: false
+ description: 'Restores past roles to a user when they rejoin.'
},
reporting: {
name: 'Reporting',
- description: 'Allow users to make reports.',
- default: false
+ description: 'Allow users to make reports.'
},
modsCanPunishMods: {
name: 'Mods Can Punish Mods',
- description: 'Allow moderators to punish other moderators.',
- default: false
- },
- sendLevelUpMessages: {
- name: 'Send Level Up Messages',
- description: 'Send a message when a user levels up.',
- default: true
+ description: 'Allow moderators to punish other moderators.'
},
logManualPunishments: {
name: 'Log Manual Punishments',
@@ -391,14 +395,7 @@ export const guildFeaturesObj = asGuildFeature({
punishmentAppeals: {
name: 'Punishment Appeals',
description: 'Allow users to appeal their punishments and send the appeal to the configured channel.',
- default: false,
- notConfigurable: true
- },
- perspectiveApi: {
- name: 'Perspective API',
- description: 'Use the Perspective API to detect toxicity.',
- default: false,
- notConfigurable: true
+ hidden: true
},
highlight: {
name: 'Highlight',
@@ -437,4 +434,6 @@ export const guildLogsArr = Object.keys(guildLogsObj).filter(
type LogChannelDB = { [x in keyof typeof guildLogsObj]?: Snowflake };
export type GuildFeatures = keyof typeof guildFeaturesObj;
-export const guildFeaturesArr: GuildFeatures[] = Object.keys(guildFeaturesObj) as GuildFeatures[];
+export const guildFeaturesArr: GuildFeatures[] = Object.keys(guildFeaturesObj).filter(
+ (f) => !guildFeaturesObj[f as keyof typeof guildFeaturesObj].hidden
+) as GuildFeatures[];
diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts
index 25d9cfe..1c79406 100644
--- a/src/listeners/ws/INTERACTION_CREATE.ts
+++ b/src/listeners/ws/INTERACTION_CREATE.ts
@@ -1,30 +1,22 @@
import { BushListener, BushUser, Moderation, ModLog, PunishmentTypePresent } from '#lib';
import assert from 'assert';
-import { TextInputStyle } from 'discord-api-types-next/v9';
import {
- APIBaseInteraction,
APIEmbed,
- APIInteraction as DiscordAPITypesAPIInteraction,
+ APIInteraction,
APIInteractionResponseChannelMessageWithSource,
APIInteractionResponseDeferredMessageUpdate,
APIInteractionResponseUpdateMessage,
APIModalInteractionResponse,
- APIModalSubmission,
ButtonStyle,
ComponentType,
GatewayDispatchEvents,
InteractionResponseType,
InteractionType,
- Routes
+ Routes,
+ TextInputStyle
} from 'discord-api-types/v9';
import { ActionRow, ButtonComponent, Embed, Snowflake } from 'discord.js';
-// todo: use from discord-api-types once updated
-export type APIModalSubmitInteraction = APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission> &
- Required<Pick<APIBaseInteraction<InteractionType.ModalSubmit, APIModalSubmission>, 'data'>>;
-
-export type APIInteraction = DiscordAPITypesAPIInteraction | APIModalSubmitInteraction;
-
export default class WsInteractionCreateListener extends BushListener {
public constructor() {
super('wsInteractionCreate', {
@@ -222,19 +214,16 @@ export default class WsInteractionCreateListener extends BushListener {
const components = [
new ActionRow({
- type: 1,
components: [
new ButtonComponent({
- type: 2,
- custom_id: `appeal_accept;${punishment};${guildId};${userId};${modlogCase}`,
+ customId: `appeal_accept;${punishment};${guildId};${userId};${modlogCase}`,
label: 'Accept',
- style: 3 /* Success */
+ style: ButtonStyle.Success
}).toJSON(),
new ButtonComponent({
- type: 2,
- custom_id: `appeal_deny;${punishment};${guildId};${userId};${modlogCase}`,
+ customId: `appeal_deny;${punishment};${guildId};${userId};${modlogCase}`,
label: 'Deny',
- style: 4 /* Danger */
+ style: ButtonStyle.Danger
}).toJSON()
]
})
diff --git a/yarn.lock b/yarn.lock
index a1ce49b..4b25f2b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -15,8 +15,8 @@ __metadata:
linkType: hard
"@discordjs/builders@npm:^0.13.0-dev":
- version: 0.13.0-dev.1645661240.8203c5d
- resolution: "@discordjs/builders@npm:0.13.0-dev.1645661240.8203c5d"
+ version: 0.13.0-dev.1645877056.a8321d8
+ resolution: "@discordjs/builders@npm:0.13.0-dev.1645877056.a8321d8"
dependencies:
"@sindresorhus/is": ^4.4.0
discord-api-types: ^0.27.0
@@ -24,20 +24,20 @@ __metadata:
ts-mixer: ^6.0.0
tslib: ^2.3.1
zod: ^3.11.6
- checksum: 8253cad2123214744680d60511285163793b048ac0720add3ac6f19145cc73b7c69e923c301ef305b14f4e19baf13c46ada80057bb1a16fa396458b703cec21d
+ checksum: 96dc1aa5f03894fbe4ec1bf697b22996b78dd1f1d776888e65f8431a6dad597cdf39b529a3e93d7bdaa6dc728f27e40bde705802f3f72f844216b3b020730f26
languageName: node
linkType: hard
"@discordjs/collection@npm:^0.6.0-dev":
- version: 0.6.0-dev.1645661250.8203c5d
- resolution: "@discordjs/collection@npm:0.6.0-dev.1645661250.8203c5d"
- checksum: f93008cebc4331fa34dd90cc679448a53bc6a5767beee6329e2f40959eec08d1db3cbe8b1281634a5cfd00da0a03aac47e892525e2eb5e0bb943c3166270ae9d
+ version: 0.6.0-dev.1645877028.a8321d8
+ resolution: "@discordjs/collection@npm:0.6.0-dev.1645877028.a8321d8"
+ checksum: ef32898a7ded84ac2f3a6efc12686b9e186a162c87153bab591cf4cf5833914479869c9b95e7e0c46126f6c4fd536ce148c123f1cb59202833328836b4eb8b9e
languageName: node
linkType: hard
"@discordjs/rest@npm:^0.4.0-dev":
- version: 0.4.0-dev.1645661242.8203c5d
- resolution: "@discordjs/rest@npm:0.4.0-dev.1645661242.8203c5d"
+ version: 0.4.0-dev.1645877008.a8321d8
+ resolution: "@discordjs/rest@npm:0.4.0-dev.1645877008.a8321d8"
dependencies:
"@discordjs/collection": ^0.6.0-dev
"@sapphire/async-queue": ^1.2.0
@@ -47,7 +47,7 @@ __metadata:
form-data: ^4.0.0
node-fetch: ^2.6.7
tslib: ^2.3.1
- checksum: ef80e9341f5345cc0426a0835fc5121bf8e47a9655e8c69d723aee2acd9387485f15d5398db223f5ff6f053dffc0e2942421d36a69f55dada1c6a51d74d0695e
+ checksum: 4a12bec50cdae4fe24e6cdf78f451b1b4ba709f85dca785dd2a25fb464336e4e4fafacd65557e0049a1b834da5e9212a308e06d873b2286fd3e5310eca00fa40
languageName: node
linkType: hard
@@ -232,7 +232,7 @@ __metadata:
languageName: node
linkType: hard
-"@sentry/integrations@npm:^6.17.9":
+"@sentry/integrations@npm:^6.18.0":
version: 6.18.0
resolution: "@sentry/integrations@npm:6.18.0"
dependencies:
@@ -255,7 +255,7 @@ __metadata:
languageName: node
linkType: hard
-"@sentry/node@npm:^6.17.9":
+"@sentry/node@npm:^6.18.0":
version: 6.18.0
resolution: "@sentry/node@npm:6.18.0"
dependencies:
@@ -272,7 +272,7 @@ __metadata:
languageName: node
linkType: hard
-"@sentry/tracing@npm:6.18.0, @sentry/tracing@npm:^6.17.9":
+"@sentry/tracing@npm:6.18.0, @sentry/tracing@npm:^6.18.0":
version: 6.18.0
resolution: "@sentry/tracing@npm:6.18.0"
dependencies:
@@ -445,16 +445,7 @@ __metadata:
languageName: node
linkType: hard
-"@types/lodash.snakecase@npm:^4.1.6":
- version: 4.1.6
- resolution: "@types/lodash.snakecase@npm:4.1.6"
- dependencies:
- "@types/lodash": "*"
- checksum: 0be8d3b8f9b2304ad86f284587a95a3625fa121daad2a3ef00104df3b4d617165a6ff3e4d52ac1c6abaf6187a2d5a59e69ee20a369dc66b91a1e949377e2c846
- languageName: node
- linkType: hard
-
-"@types/lodash@npm:*, @types/lodash@npm:^4.14.179":
+"@types/lodash@npm:^4.14.179":
version: 4.14.179
resolution: "@types/lodash@npm:4.14.179"
checksum: 71faa0c8071732c2b7f0bd092850d3cea96fc7912055d57d819cf2ab399a64150e4190d8a4ea35a0905662ddc118be9d2abd55891d8047c085acf98608156149
@@ -967,14 +958,13 @@ __metadata:
"@notenoughupdates/simplify-number": ^1.0.1
"@notenoughupdates/wolfram-alpha-api": ^1.0.1
"@sapphire/snowflake": ^3.1.0
- "@sentry/integrations": ^6.17.9
- "@sentry/node": ^6.17.9
- "@sentry/tracing": ^6.17.9
+ "@sentry/integrations": ^6.18.0
+ "@sentry/node": ^6.18.0
+ "@sentry/tracing": ^6.18.0
"@sentry/types": ^6.18.0
"@types/eslint": ^8.4.1
"@types/express": ^4.17.13
"@types/lodash": ^4.14.179
- "@types/lodash.snakecase": ^4.1.6
"@types/node": ^17.0.21
"@types/node-os-utils": ^1.2.0
"@types/numeral": ^2.0.2
@@ -990,7 +980,6 @@ __metadata:
deep-lock: ^1.0.0
discord-akairo: "npm:@notenoughupdates/discord-akairo@dev"
discord-api-types: 0.27.3
- discord-api-types-next: "npm:discord-api-types@next"
discord.js: "npm:@notenoughupdates/discord.js@dev"
eslint: ^8.10.0
eslint-config-prettier: ^8.4.0
@@ -1345,13 +1334,6 @@ __metadata:
languageName: node
linkType: hard
-"discord-api-types-next@npm:discord-api-types@next":
- version: 0.28.0-next.3e3acb5.1645823148
- resolution: "discord-api-types@npm:0.28.0-next.3e3acb5.1645823148"
- checksum: f3c6171af2676da424c9df4f2f0663dab66c8058e7c23fd3b8d97d76696a4a19876befa71bae0a45e8257a75a7c0e92a269cea86dea3ffe1391eea0377a02b1a
- languageName: node
- linkType: hard
-
"discord-api-types@npm:0.27.3":
version: 0.27.3
resolution: "discord-api-types@npm:0.27.3"
@@ -1360,8 +1342,8 @@ __metadata:
linkType: hard
"discord.js@npm:@notenoughupdates/discord.js@dev":
- version: 14.0.0-dev.1645848189.78de9df
- resolution: "@notenoughupdates/discord.js@npm:14.0.0-dev.1645848189.78de9df"
+ version: 14.0.0-dev.1645891423.ca3c48a
+ resolution: "@notenoughupdates/discord.js@npm:14.0.0-dev.1645891423.ca3c48a"
dependencies:
"@discordjs/builders": ^0.13.0-dev
"@discordjs/collection": ^0.6.0-dev
@@ -1372,7 +1354,7 @@ __metadata:
lodash.snakecase: ^4.1.1
undici: ^4.14.1
ws: ^8.5.0
- checksum: 5f33f54daba5ee258677439e37362a953129d6910418e3f72b6c453aafd15db926a3129faf981878e3a249cf3f886baffc3a6a730916e38ec8158bbfcdf5ff9a
+ checksum: d3e077a79e444d4bde071fcc0a571ef021442fa76826aa55fc2e00ba65a78f6ab1e39bf60b7031bc81dc1c95ed03d48791f9adb54512d81d8c92920a46effc94
languageName: node
linkType: hard