Compare commits

..

2 Commits

Author SHA1 Message Date
semantic-release-bot
b4a5c62549 chore(release): 1.2.1 [skip ci]
## @revanced/discord-bot [1.2.1](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.2.0...@revanced/discord-bot@1.2.1) (2025-05-02)

### Bug Fixes

* **bots/discord:** fix timeout overflow check for role presets ([495f686](495f686292))
2025-05-02 16:11:20 +00:00
PalmDevs
495f686292 fix(bots/discord): fix timeout overflow check for role presets 2025-05-02 23:01:37 +07:00
5 changed files with 16 additions and 5 deletions

View File

@@ -1,3 +1,10 @@
## @revanced/discord-bot [1.2.1](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.2.0...@revanced/discord-bot@1.2.1) (2025-05-02)
### Bug Fixes
* **bots/discord:** fix timeout overflow check for role presets ([495f686](https://github.com/revanced/revanced-bots/commit/495f686292ebdcf51902c1dc75ac1510d7fdbd9c))
# @revanced/discord-bot [1.2.0](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.1.2...@revanced/discord-bot@1.2.0) (2025-05-02)

View File

@@ -2,7 +2,7 @@
"name": "@revanced/discord-bot",
"type": "module",
"private": true,
"version": "1.2.0",
"version": "1.2.1",
"description": "🤖 Discord bot assisting ReVanced",
"main": "src/index.ts",
"scripts": {

View File

@@ -3,7 +3,7 @@ import CommandError, { CommandErrorType } from '$/classes/CommandError'
import { createModerationActionEmbed } from '$/utils/discord/embeds'
import { sendModerationReplyAndLogs } from '$/utils/discord/moderation'
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
import { parseDuration } from '$/utils/duration'
import { isSafeTimeoutDuration, parseDuration } from '$/utils/duration'
export default new ModerationCommand({
name: 'mute',
@@ -63,7 +63,7 @@ export default new ModerationCommand({
createModerationActionEmbed('Muted', user, executor.user, reason, Math.ceil(expires / 1000)),
)
if (Number.isSafeInteger(expires))
if (isSafeTimeoutDuration(duration))
setTimeout(() => {
removeRolePreset(member, 'mute')
}, duration)

View File

@@ -2,7 +2,7 @@ import { ModerationCommand } from '$/classes/Command'
import CommandError, { CommandErrorType } from '$/classes/CommandError'
import { sendPresetReplyAndLogs } from '$/utils/discord/moderation'
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
import { parseDuration } from '$/utils/duration'
import { isSafeTimeoutDuration, parseDuration } from '$/utils/duration'
const SubcommandOptions = {
member: {
@@ -78,7 +78,7 @@ export default new ModerationCommand({
)
}
if (Number.isSafeInteger(expires))
if (expires && isSafeTimeoutDuration(expires))
setTimeout(() => {
removeRolePreset(member, preset)
}, expires)

View File

@@ -38,3 +38,7 @@ export const durationToString = (duration: number) => {
left: '',
})
}
export function isSafeTimeoutDuration(duration: number) {
return duration > 0 && duration < 2 ** 31 - 1
}