diff --git a/src/config.ts b/src/config.ts index b16e7a7..d36fb2d 100644 --- a/src/config.ts +++ b/src/config.ts @@ -15,6 +15,10 @@ function loadConfig(): Config { throw new Error('Config missing telegram.chatId') } + if (config.ignoredUserIds && !Array.isArray(config.ignoredUserIds)) { + throw new Error('ignoredUserIds must be an array') + } + if (!Array.isArray(config.servers) || config.servers.length === 0) { throw new Error('Config missing servers array') } diff --git a/src/discord/handlers.ts b/src/discord/handlers.ts index 29f616b..233b17c 100644 --- a/src/discord/handlers.ts +++ b/src/discord/handlers.ts @@ -28,6 +28,9 @@ async function handleMessage(message: Message): Promise { if ((message.reference as any)?.type === 'FORWARD') return + if (config.ignoredUserIds?.includes(message.author.id)) + return + const serverConfig = config.servers.find((s: { guildId: string }) => s.guildId === message.guild!.id) if (!serverConfig) return diff --git a/src/types.ts b/src/types.ts index 807bf00..7d08c46 100644 --- a/src/types.ts +++ b/src/types.ts @@ -22,6 +22,7 @@ export interface Config { chatId: string } servers: ServerConfig[] + ignoredUserIds?: string[] } export interface ForwardMessageOptions {