diff --git a/bots/discord/config.revanced.ts b/bots/discord/config.revanced.ts index 641ef16..acd2afe 100644 --- a/bots/discord/config.revanced.ts +++ b/bots/discord/config.revanced.ts @@ -1,5 +1,5 @@ import { PermissionFlagsBits } from 'discord.js' -import type { Config } from './config.example' +import type { Config } from './config.schema' export default { owners: ['629368283354628116', '737323631117598811', '282584705218510848'], diff --git a/bots/discord/config.example.ts b/bots/discord/config.schema.ts similarity index 51% rename from bots/discord/config.example.ts rename to bots/discord/config.schema.ts index 70f9451..da36dd0 100644 --- a/bots/discord/config.example.ts +++ b/bots/discord/config.schema.ts @@ -1,47 +1,3 @@ -export default { - owners: ['USER_ID_HERE'], - guilds: ['GUILD_ID_HERE'], - messageScan: { - filter: { - channels: ['CHANNEL_ID_HERE'], - roles: ['ROLE_ID_HERE'], - users: ['USER_ID_HERE'], - whitelist: false, - }, - humanCorrections: { - falsePositiveLabel: 'false_positive', - allow: { - members: { - permissions: 8n, - roles: ['ROLE_ID_HERE'], - }, - }, - }, - allowedAttachmentMimeTypes: ['image/jpeg', 'image/png', 'image/webp'], - responses: [ - { - triggers: { - text: [/^regexp?$/, { label: 'label', threshold: 0.85 }], - }, - response: { - title: 'Embed title', - description: 'Embed description', - fields: [ - { - name: 'Field name', - value: 'Field value', - }, - ], - }, - }, - ], - }, - logLevel: 'log', - api: { - websocketUrl: 'ws://127.0.0.1:3000', - }, -} satisfies Config as Config - export type Config = { owners: string[] guilds: string[] diff --git a/bots/discord/config.ts b/bots/discord/config.ts new file mode 100644 index 0000000..9749e31 --- /dev/null +++ b/bots/discord/config.ts @@ -0,0 +1,45 @@ +import type { Config } from './config.schema' + +export default { + owners: ['USER_ID_HERE'], + guilds: ['GUILD_ID_HERE'], + messageScan: { + filter: { + channels: ['CHANNEL_ID_HERE'], + roles: ['ROLE_ID_HERE'], + users: ['USER_ID_HERE'], + whitelist: false, + }, + humanCorrections: { + falsePositiveLabel: 'false_positive', + allow: { + members: { + permissions: 8n, + roles: ['ROLE_ID_HERE'], + }, + }, + }, + allowedAttachmentMimeTypes: ['image/jpeg', 'image/png', 'image/webp'], + responses: [ + { + triggers: { + text: [/^regexp?$/, { label: 'label', threshold: 0.85 }], + }, + response: { + title: 'Embed title', + description: 'Embed description', + fields: [ + { + name: 'Field name', + value: 'Field value', + }, + ], + }, + }, + ], + }, + logLevel: 'log', + api: { + websocketUrl: 'ws://127.0.0.1:3000', + }, +} satisfies Config as Config diff --git a/bots/discord/docs/1_configuration.md b/bots/discord/docs/1_configuration.md index 35408fc..8cc2631 100644 --- a/bots/discord/docs/1_configuration.md +++ b/bots/discord/docs/1_configuration.md @@ -1,6 +1,6 @@ # ⚙️ Configuration -You will need to copy `config.example.ts` to `config.ts` to be able to start the bot, as it is the default configuration. +See [`config.ts`](../config.ts). --- diff --git a/bots/discord/docs/2_adding_autoresponses.md b/bots/discord/docs/2_adding_autoresponses.md index 3fd25d7..bb028a8 100644 --- a/bots/discord/docs/2_adding_autoresponses.md +++ b/bots/discord/docs/2_adding_autoresponses.md @@ -79,7 +79,7 @@ filterOverride: { }, ``` -[^1]: Possible triggers are regular expressions or [label configurations](../config.example.ts#L83). +[^1]: Possible triggers are regular expressions or [label configurations](../config.schema.ts#L83). Label configurations are only allowed for **text scans** currently. However in the future, it may also come for image scans. There is nothing preventing this from happening. ## ⏭️ What's next diff --git a/bots/discord/src/events/discord/messageReactionAdd/correct-response.ts b/bots/discord/src/events/discord/messageReactionAdd/correct-response.ts index e242fca..d562c0c 100644 --- a/bots/discord/src/events/discord/messageReactionAdd/correct-response.ts +++ b/bots/discord/src/events/discord/messageReactionAdd/correct-response.ts @@ -11,7 +11,7 @@ import { } from 'discord.js' import { handleUserResponseCorrection } from '$/utils/discord/messageScan' -import type { ConfigMessageScanResponseLabelConfig } from 'config.example' +import type { ConfigMessageScanResponseLabelConfig } from 'config.schema' const PossibleReactions = Object.values(Reactions) as string[] diff --git a/bots/discord/src/utils/discord/embeds.ts b/bots/discord/src/utils/discord/embeds.ts index 4ca387d..cbb1173 100644 --- a/bots/discord/src/utils/discord/embeds.ts +++ b/bots/discord/src/utils/discord/embeds.ts @@ -1,6 +1,6 @@ import { DefaultEmbedColor, MessageScanHumanizedMode, ReVancedLogoURL } from '$/constants' import { EmbedBuilder } from 'discord.js' -import type { ConfigMessageScanResponseMessage } from '../../../config.example' +import type { ConfigMessageScanResponseMessage } from '../../../config.schema' export const createErrorEmbed = (title: string, description?: string) => applyCommonEmbedStyles( diff --git a/bots/discord/src/utils/discord/messageScan.ts b/bots/discord/src/utils/discord/messageScan.ts index c798767..ce9c180 100644 --- a/bots/discord/src/utils/discord/messageScan.ts +++ b/bots/discord/src/utils/discord/messageScan.ts @@ -4,7 +4,7 @@ import type { ConfigMessageScanResponse, ConfigMessageScanResponseLabelConfig, ConfigMessageScanResponseMessage, -} from 'config.example' +} from 'config.schema' import type { Message, PartialUser, User } from 'discord.js' import { createMessageScanResponseEmbed } from './embeds' diff --git a/bots/discord/src/utils/discord/modLogs.ts b/bots/discord/src/utils/discord/modLogs.ts new file mode 100644 index 0000000..e69de29