chore(bots/discord): add default config

This commit is contained in:
PalmDevs
2024-04-03 15:34:33 +07:00
parent 513c6b18f0
commit c1e1953762
9 changed files with 51 additions and 50 deletions

View File

@@ -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'],

View File

@@ -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[]

45
bots/discord/config.ts Normal file
View File

@@ -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

View File

@@ -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).
---

View File

@@ -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

View File

@@ -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[]

View File

@@ -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(

View File

@@ -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'