feat(bots/discord): add sticky messages

This commit is contained in:
PalmDevs
2024-08-01 02:28:54 +07:00
parent 763ef253f9
commit bf661556e1
9 changed files with 123 additions and 24 deletions

View File

@@ -3,7 +3,7 @@ import { existsSync, readFileSync, readdirSync } from 'fs'
import { join } from 'path'
import { Client as APIClient } from '@revanced/bot-api'
import { createLogger } from '@revanced/bot-shared'
import { Client as DiscordClient, Partials } from 'discord.js'
import { Client as DiscordClient, type Message, Partials } from 'discord.js'
import { drizzle } from 'drizzle-orm/bun-sqlite'
// Export some things first, as commands require them
@@ -85,4 +85,19 @@ export const discord = {
string,
Command<boolean, CommandOptionsOptions | undefined, boolean>
>,
stickyMessages: {} as Record<
string,
Record<
string,
{
forceSendTimerActive?: boolean
timeoutMs: number
forceSendMs?: number
send: (forced?: boolean) => Promise<void>
currentMessage?: Message<true>
interval?: NodeJS.Timeout
forceSendInterval?: NodeJS.Timeout
}
>
>,
} as const