mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
fix(bots/discord): correct timer active condition for sticky messages
This commit is contained in:
@@ -7,12 +7,13 @@ withContext(on, 'messageCreate', async ({ discord, logger }, msg) => {
|
||||
const store = discord.stickyMessages[msg.guildId]?.[msg.channelId]
|
||||
if (!store) return
|
||||
|
||||
const timerPreviouslyActive = store.timerActive
|
||||
// If there isn't a timer, start it up
|
||||
store.timerActive = true
|
||||
if (!store.timer) store.timer = setTimeout(store.send, store.timerMs) as NodeJS.Timeout
|
||||
else {
|
||||
// If there is a timer, but it isn't active, restart it
|
||||
if (!store.timerActive) store.timer.refresh()
|
||||
if (!timerPreviouslyActive) store.timer.refresh()
|
||||
// If there is a timer and it is active, but the force timer isn't active...
|
||||
else if (!store.forceTimerActive && store.forceTimerMs) {
|
||||
logger.debug(`Channel ${msg.channelId} in guild ${msg.guildId} is active, starting force send timer and clearing existing timer`)
|
||||
|
||||
Reference in New Issue
Block a user