mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 21:56:17 +00:00
Compare commits
2 Commits
dev
...
@revanced/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02e24eed70 | ||
|
|
9d7bd3286a |
@@ -1,3 +1,10 @@
|
||||
## @revanced/discord-bot [1.1.3-dev.1](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.1.2...@revanced/discord-bot@1.1.3-dev.1) (2025-05-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bots/discord:** fix timeout overflow check for role presets ([9d7bd32](https://github.com/revanced/revanced-bots/commit/9d7bd3286ad0ad4bdccda6a6c34788bdc53a8fd4))
|
||||
|
||||
## @revanced/discord-bot [1.1.2](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.1.1...@revanced/discord-bot@1.1.2) (2025-04-16)
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@revanced/discord-bot",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3-dev.1",
|
||||
"description": "🤖 Discord bot assisting ReVanced",
|
||||
"main": "src/index.ts",
|
||||
"scripts": {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -23,3 +23,7 @@ export const durationToString = (duration: number) => {
|
||||
seconds ? `${seconds}s` : ''
|
||||
}`
|
||||
}
|
||||
|
||||
export function isSafeTimeoutDuration(duration: number) {
|
||||
return duration > 0 && duration < 2 ** 31 - 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user