mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-17 16:23:58 +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]
|
const store = discord.stickyMessages[msg.guildId]?.[msg.channelId]
|
||||||
if (!store) return
|
if (!store) return
|
||||||
|
|
||||||
|
const timerPreviouslyActive = store.timerActive
|
||||||
// If there isn't a timer, start it up
|
// If there isn't a timer, start it up
|
||||||
store.timerActive = true
|
store.timerActive = true
|
||||||
if (!store.timer) store.timer = setTimeout(store.send, store.timerMs) as NodeJS.Timeout
|
if (!store.timer) store.timer = setTimeout(store.send, store.timerMs) as NodeJS.Timeout
|
||||||
else {
|
else {
|
||||||
// If there is a timer, but it isn't active, restart it
|
// 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...
|
// If there is a timer and it is active, but the force timer isn't active...
|
||||||
else if (!store.forceTimerActive && store.forceTimerMs) {
|
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`)
|
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