mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-12 06:06:21 +00:00
Compare commits
5 Commits
@revanced/
...
@revanced/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
409e850768 | ||
|
|
6e89b874cd | ||
|
|
b4a5c62549 | ||
|
|
495f686292 | ||
|
|
71eb11b67f |
@@ -1,4 +1,18 @@
|
||||
# @revanced/discord-bot [1.2.0-dev.1](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.1.2...@revanced/discord-bot@1.2.0-dev.1) (2025-05-02)
|
||||
## @revanced/discord-bot [1.2.2](https://github.com/revanced/revanced-bots/compare/@revanced/discord-bot@1.2.1...@revanced/discord-bot@1.2.2) (2025-06-10)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **bots/discord:** use intervals for checking expired presets ([6e89b87](https://github.com/revanced/revanced-bots/commit/6e89b874cdfee8a1c215559271c741f43ba578ce))
|
||||
|
||||
## @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)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "@revanced/discord-bot",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"version": "1.2.0-dev.1",
|
||||
"version": "1.2.2",
|
||||
"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)
|
||||
|
||||
@@ -9,7 +9,7 @@ import { type Client, DiscordAPIError } from 'discord.js'
|
||||
export default withContext(on, 'ready', async ({ config }, client) => {
|
||||
if (config.rolePresets) {
|
||||
removeExpiredPresets(client)
|
||||
setTimeout(() => removeExpiredPresets(client), config.rolePresets.checkExpiredEvery)
|
||||
setInterval(() => removeExpiredPresets(client), config.rolePresets.checkExpiredEvery)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -38,3 +38,7 @@ export const durationToString = (duration: number) => {
|
||||
left: '',
|
||||
})
|
||||
}
|
||||
|
||||
export function isSafeTimeoutDuration(duration: number) {
|
||||
return duration > 0 && duration < 2 ** 31 - 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user