feat: add global ignoredUserIds config option
Skip messages from specified Discord user IDs regardless of channel/role matching. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
594b0e7a48
commit
165f43a691
3 changed files with 8 additions and 0 deletions
|
|
@ -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')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ async function handleMessage(message: Message): Promise<void> {
|
|||
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
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export interface Config {
|
|||
chatId: string
|
||||
}
|
||||
servers: ServerConfig[]
|
||||
ignoredUserIds?: string[]
|
||||
}
|
||||
|
||||
export interface ForwardMessageOptions {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue