mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 21:56:17 +00:00
Compare commits
2 Commits
@revanced/
...
@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)
|
## @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",
|
"name": "@revanced/discord-bot",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.1.2",
|
"version": "1.1.3-dev.1",
|
||||||
"description": "🤖 Discord bot assisting ReVanced",
|
"description": "🤖 Discord bot assisting ReVanced",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
|||||||
import { createModerationActionEmbed } from '$/utils/discord/embeds'
|
import { createModerationActionEmbed } from '$/utils/discord/embeds'
|
||||||
import { sendModerationReplyAndLogs } from '$/utils/discord/moderation'
|
import { sendModerationReplyAndLogs } from '$/utils/discord/moderation'
|
||||||
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
|
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
|
||||||
import { parseDuration } from '$/utils/duration'
|
import { isSafeTimeoutDuration, parseDuration } from '$/utils/duration'
|
||||||
|
|
||||||
export default new ModerationCommand({
|
export default new ModerationCommand({
|
||||||
name: 'mute',
|
name: 'mute',
|
||||||
@@ -63,7 +63,7 @@ export default new ModerationCommand({
|
|||||||
createModerationActionEmbed('Muted', user, executor.user, reason, Math.ceil(expires / 1000)),
|
createModerationActionEmbed('Muted', user, executor.user, reason, Math.ceil(expires / 1000)),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (Number.isSafeInteger(expires))
|
if (isSafeTimeoutDuration(duration))
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
removeRolePreset(member, 'mute')
|
removeRolePreset(member, 'mute')
|
||||||
}, duration)
|
}, duration)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { ModerationCommand } from '$/classes/Command'
|
|||||||
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
||||||
import { sendPresetReplyAndLogs } from '$/utils/discord/moderation'
|
import { sendPresetReplyAndLogs } from '$/utils/discord/moderation'
|
||||||
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
|
import { applyRolePreset, removeRolePreset } from '$/utils/discord/rolePresets'
|
||||||
import { parseDuration } from '$/utils/duration'
|
import { isSafeTimeoutDuration, parseDuration } from '$/utils/duration'
|
||||||
|
|
||||||
const SubcommandOptions = {
|
const SubcommandOptions = {
|
||||||
member: {
|
member: {
|
||||||
@@ -78,7 +78,7 @@ export default new ModerationCommand({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Number.isSafeInteger(expires))
|
if (expires && isSafeTimeoutDuration(expires))
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
removeRolePreset(member, preset)
|
removeRolePreset(member, preset)
|
||||||
}, expires)
|
}, expires)
|
||||||
|
|||||||
@@ -23,3 +23,7 @@ export const durationToString = (duration: number) => {
|
|||||||
seconds ? `${seconds}s` : ''
|
seconds ? `${seconds}s` : ''
|
||||||
}`
|
}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isSafeTimeoutDuration(duration: number) {
|
||||||
|
return duration > 0 && duration < 2 ** 31 - 1
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user