mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-12 06:06:21 +00:00
Compare commits
9 Commits
@revanced/
...
@revanced/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d290417ff3 | ||
|
|
a21aa348d7 | ||
|
|
479812e199 | ||
|
|
f6119946f8 | ||
|
|
5d1af3c31c | ||
|
|
14c98e87df | ||
|
|
8e3946a666 | ||
|
|
c2009ca6d4 | ||
|
|
22d3eea88d |
@@ -1,3 +1,11 @@
|
|||||||
|
# @revanced/bot-websocket-api [1.0.0-dev.10](https://github.com/revanced/revanced-bots/compare/@revanced/bot-websocket-api@1.0.0-dev.9...@revanced/bot-websocket-api@1.0.0-dev.10) (2025-03-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* fix typings and formatting ([479812e](https://github.com/revanced/revanced-bots/commit/479812e199b52cdb295a5746e0767306afab3413))
|
||||||
|
* update repo url ([a21aa34](https://github.com/revanced/revanced-bots/commit/a21aa348d7f32cd0ee65b371e9594520c0a9d3f1))
|
||||||
|
|
||||||
# @revanced/bot-websocket-api [1.0.0-dev.9](https://github.com/revanced/revanced-helper/compare/@revanced/bot-websocket-api@1.0.0-dev.8...@revanced/bot-websocket-api@1.0.0-dev.9) (2024-08-03)
|
# @revanced/bot-websocket-api [1.0.0-dev.9](https://github.com/revanced/revanced-helper/compare/@revanced/bot-websocket-api@1.0.0-dev.8...@revanced/bot-websocket-api@1.0.0-dev.9) (2024-08-03)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "@revanced/bot-websocket-api",
|
"name": "@revanced/bot-websocket-api",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.0-dev.9",
|
"version": "1.0.0-dev.10",
|
||||||
"description": "🧦 WebSocket API server for bots assisting ReVanced",
|
"description": "🧦 WebSocket API server for bots assisting ReVanced",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/revanced/revanced-helper.git",
|
"url": "git+https://github.com/revanced/revanced-bots.git",
|
||||||
"directory": "apis/websocket"
|
"directory": "apis/websocket"
|
||||||
},
|
},
|
||||||
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
],
|
],
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/revanced/revanced-helper/issues"
|
"url": "https://github.com/revanced/revanced-bots/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/revanced/revanced-helper#readme",
|
"homepage": "https://github.com/revanced/revanced-bots#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@revanced/bot-shared": "workspace:*",
|
"@revanced/bot-shared": "workspace:*",
|
||||||
"@sapphire/async-queue": "^1.5.3",
|
"@sapphire/async-queue": "^1.5.3",
|
||||||
@@ -37,4 +37,4 @@
|
|||||||
"@types/ws": "^8.5.12",
|
"@types/ws": "^8.5.12",
|
||||||
"typed-emitter": "^2.1.0"
|
"typed-emitter": "^2.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { createLogger } from '@revanced/bot-shared'
|
import { createLogger } from '@revanced/bot-shared'
|
||||||
import { cp, rm } from 'fs/promises'
|
import { cp, exists, rm } from 'fs/promises'
|
||||||
|
|
||||||
const logger = createLogger()
|
const logger = createLogger()
|
||||||
|
|
||||||
logger.info('Cleaning previous build...')
|
logger.info('Cleaning previous build...')
|
||||||
await rm('./dist', { recursive: true })
|
if (await exists('./dist')) await rm('./dist', { recursive: true })
|
||||||
|
|
||||||
logger.info('Building WebSocket API...')
|
logger.info('Building WebSocket API...')
|
||||||
await Bun.build({
|
await Bun.build({
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ export default class Client {
|
|||||||
protected _toBuffer(data: RawData) {
|
protected _toBuffer(data: RawData) {
|
||||||
if (data instanceof Buffer) return data
|
if (data instanceof Buffer) return data
|
||||||
if (data instanceof ArrayBuffer) return Buffer.from(data)
|
if (data instanceof ArrayBuffer) return Buffer.from(data)
|
||||||
return Buffer.concat(data)
|
return Buffer.concat(data as Uint8Array[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ export default {
|
|||||||
},
|
},
|
||||||
timeout: 60000,
|
timeout: 60000,
|
||||||
forceSendTimeout: 300000,
|
forceSendTimeout: 300000,
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
moderation: {
|
moderation: {
|
||||||
cure: {
|
cure: {
|
||||||
@@ -77,7 +77,7 @@ export default {
|
|||||||
attachments: {
|
attachments: {
|
||||||
scanAttachments: true,
|
scanAttachments: true,
|
||||||
allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp', 'text/plain'],
|
allowedMimeTypes: ['image/jpeg', 'image/png', 'image/webp', 'text/plain'],
|
||||||
maxTextFileSize: 512000
|
maxTextFileSize: 512000,
|
||||||
},
|
},
|
||||||
responses: [
|
responses: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/revanced/revanced-helper.git",
|
"url": "git+https://github.com/revanced/revanced-bots.git",
|
||||||
"directory": "bots/discord"
|
"directory": "bots/discord"
|
||||||
},
|
},
|
||||||
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
],
|
],
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/revanced/revanced-helper/issues"
|
"url": "https://github.com/revanced/revanced-bots/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/revanced/revanced-helper#readme",
|
"homepage": "https://github.com/revanced/revanced-bots#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/builders": "^1.9.0",
|
"@discordjs/builders": "^1.9.0",
|
||||||
"@discordjs/rest": "^2.4.0",
|
"@discordjs/rest": "^2.4.0",
|
||||||
@@ -43,4 +43,4 @@
|
|||||||
"discord-api-types": "^0.37.102",
|
"discord-api-types": "^0.37.102",
|
||||||
"drizzle-kit": "^0.22.8"
|
"drizzle-kit": "^0.22.8"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export default new ModerationCommand({
|
|||||||
},
|
},
|
||||||
dmt: {
|
dmt: {
|
||||||
description:
|
description:
|
||||||
'Time duration to delete messages (default time unit is days, must be from 0s to 7d, default value is 0s)',
|
'Time duration to delete messages (default time unit is days, must be from 0s to 7d, default is 0s)',
|
||||||
required: false,
|
required: false,
|
||||||
type: ModerationCommand.OptionType.String,
|
type: ModerationCommand.OptionType.String,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import Command from '$/classes/Command'
|
import Command from '$/classes/Command'
|
||||||
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
||||||
import { config } from '../../../context'
|
|
||||||
import type { FetchMessageOptions, MessageResolvable } from 'discord.js'
|
|
||||||
import type { ConfigMessageScanResponseLabelConfig } from 'config.schema'
|
|
||||||
import { createSuccessEmbed } from '$/utils/discord/embeds'
|
import { createSuccessEmbed } from '$/utils/discord/embeds'
|
||||||
|
import type { ConfigMessageScanResponseLabelConfig } from 'config.schema'
|
||||||
|
import type { FetchMessageOptions, MessageResolvable } from 'discord.js'
|
||||||
|
import { config } from '../../../context'
|
||||||
|
|
||||||
const msRcConfig = config.messageScan?.humanCorrections?.allow
|
const msRcConfig = config.messageScan?.humanCorrections?.allow
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import Command from '$/classes/Command'
|
import Command from '$/classes/Command'
|
||||||
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
import CommandError, { CommandErrorType } from '$/classes/CommandError'
|
||||||
import { config } from '../../../context'
|
|
||||||
import { type APIStringSelectComponent, ComponentType } from 'discord.js'
|
|
||||||
import type { ConfigMessageScanResponseLabelConfig } from 'config.schema'
|
import type { ConfigMessageScanResponseLabelConfig } from 'config.schema'
|
||||||
|
import { type APIStringSelectComponent, ComponentType } from 'discord.js'
|
||||||
|
import { config } from '../../../context'
|
||||||
|
|
||||||
const msRcConfig = config.messageScan?.humanCorrections?.allow
|
const msRcConfig = config.messageScan?.humanCorrections?.allow
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ export const discord = {
|
|||||||
parse: ['users'],
|
parse: ['users'],
|
||||||
repliedUser: true,
|
repliedUser: true,
|
||||||
},
|
},
|
||||||
partials: [Partials.Message, Partials.Reaction],
|
partials: [Partials.Message, Partials.Reaction, Partials.GuildMember],
|
||||||
}),
|
}),
|
||||||
commands: Object.fromEntries(Object.values(commands).map(cmd => [cmd.name, cmd])) as Record<
|
commands: Object.fromEntries(Object.values(commands).map(cmd => [cmd.name, cmd])) as Record<
|
||||||
string,
|
string,
|
||||||
|
|||||||
@@ -9,8 +9,7 @@ withContext(on, 'interactionCreate', async (context, interaction) => {
|
|||||||
const command = discord.commands[interaction.commandName]
|
const command = discord.commands[interaction.commandName]
|
||||||
|
|
||||||
logger.debug(`Command ${interaction.commandName} being invoked by ${interaction.user.tag} via chat`)
|
logger.debug(`Command ${interaction.commandName} being invoked by ${interaction.user.tag} via chat`)
|
||||||
if (!command)
|
if (!command) return void logger.error(`Chat command ${interaction.commandName} not implemented but registered!!!`)
|
||||||
return void logger.error(`Chat command ${interaction.commandName} not implemented but registered!!!`)
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug(`Command ${interaction.commandName} being executed via chat`)
|
logger.debug(`Command ${interaction.commandName} being executed via chat`)
|
||||||
|
|||||||
@@ -8,28 +8,34 @@ withContext(on, 'messageCreate', async ({ discord, logger }, msg) => {
|
|||||||
if (!store) return
|
if (!store) return
|
||||||
|
|
||||||
if (store.timerActive) {
|
if (store.timerActive) {
|
||||||
if (!store.forceTimerActive && store.forceTimerMs) {
|
// Timer is already active, so we try to start the force timer
|
||||||
logger.debug(
|
if (store.forceTimerMs) {
|
||||||
`Channel ${msg.channelId} in guild ${msg.guildId} is active, starting force send timer and clearing existing timer`,
|
// Force timer isn't active, so we start it
|
||||||
)
|
if (!store.forceTimerActive) {
|
||||||
|
logger.debug(
|
||||||
|
`Channel ${msg.channelId} in guild ${msg.guildId} is active, starting force send timer and clearing existing timer`,
|
||||||
|
)
|
||||||
|
|
||||||
// Clear the timer
|
// Clear the timer
|
||||||
clearTimeout(store.timer)
|
clearTimeout(store.timer)
|
||||||
store.timerActive = false
|
store.timerActive = false
|
||||||
|
|
||||||
// (Re)start the force timer
|
// (Re)start the force timer
|
||||||
store.forceTimerActive = true
|
store.forceTimerActive = true
|
||||||
if (!store.forceTimer)
|
if (!store.forceTimer)
|
||||||
store.forceTimer = setTimeout(
|
store.forceTimer = setTimeout(
|
||||||
() =>
|
() =>
|
||||||
store.send(true).then(() => {
|
store.send(true).then(() => {
|
||||||
store.forceTimerActive = false
|
store.forceTimerActive = false
|
||||||
}),
|
}),
|
||||||
store.forceTimerMs,
|
store.forceTimerMs,
|
||||||
) as NodeJS.Timeout
|
) as NodeJS.Timeout
|
||||||
else store.forceTimer.refresh()
|
else store.forceTimer.refresh()
|
||||||
|
// Force timer is already active, so we force send
|
||||||
|
} else store.send()
|
||||||
}
|
}
|
||||||
} else if (!store.forceTimerActive) {
|
} else if (!store.forceTimerActive) {
|
||||||
|
// Both timers aren't active, so we start the timer
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ const PossibleReactions = Object.values(Reactions) as string[]
|
|||||||
|
|
||||||
withContext(on, 'messageReactionAdd', async (context, rct, user) => {
|
withContext(on, 'messageReactionAdd', async (context, rct, user) => {
|
||||||
if (user.bot) return
|
if (user.bot) return
|
||||||
|
|
||||||
const { database: db, logger, config } = context
|
const { database: db, logger, config } = context
|
||||||
const { messageScan: msConfig } = config
|
const { messageScan: msConfig } = config
|
||||||
|
|
||||||
// If there's no config, we can't do anything
|
// If there's no config, we can't do anything
|
||||||
if (!msConfig?.humanCorrections) return
|
if (!msConfig?.humanCorrections) return
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { appliedPresets } from '$/database/schemas'
|
|||||||
import { applyCommonEmbedStyles } from '$/utils/discord/embeds'
|
import { applyCommonEmbedStyles } from '$/utils/discord/embeds'
|
||||||
import { on, withContext } from '$/utils/discord/events'
|
import { on, withContext } from '$/utils/discord/events'
|
||||||
import { removeRolePreset } from '$/utils/discord/rolePresets'
|
import { removeRolePreset } from '$/utils/discord/rolePresets'
|
||||||
import { lt } from 'drizzle-orm'
|
import { and, eq, lt } from 'drizzle-orm'
|
||||||
|
|
||||||
import type { Client } from 'discord.js'
|
import type { Client } from 'discord.js'
|
||||||
|
|
||||||
@@ -92,11 +92,15 @@ const removeExpiredPresets = async (client: Client) => {
|
|||||||
|
|
||||||
for (const expired of expireds)
|
for (const expired of expireds)
|
||||||
try {
|
try {
|
||||||
|
logger.debug(`Removing role preset for ${expired.memberId} in ${expired.guildId}`)
|
||||||
|
|
||||||
const guild = await client.guilds.fetch(expired.guildId)
|
const guild = await client.guilds.fetch(expired.guildId)
|
||||||
const member = await guild.members.fetch(expired.memberId)
|
const member = await guild.members.fetch(expired.memberId)
|
||||||
|
|
||||||
logger.debug(`Removing role preset for ${expired.memberId} in ${expired.guildId}`)
|
|
||||||
await removeRolePreset(member, expired.preset)
|
await removeRolePreset(member, expired.preset)
|
||||||
|
await database
|
||||||
|
.delete(appliedPresets)
|
||||||
|
.where(and(eq(appliedPresets.guildId, expired.guildId), eq(appliedPresets.memberId, expired.memberId)))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.error(`Error while removing role preset for ${expired.memberId} in ${expired.guildId}: ${e}`)
|
logger.error(`Error while removing role preset for ${expired.memberId} in ${expired.guildId}: ${e}`)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export const cureNickname = async (member: GuildMember) => {
|
|||||||
cured =
|
cured =
|
||||||
member.user.username.length >= 3
|
member.user.username.length >= 3
|
||||||
? member.user.username
|
? member.user.username
|
||||||
: config.moderation?.cure?.defaultName ?? 'Server member'
|
: (config.moderation?.cure?.defaultName ?? 'Server member')
|
||||||
|
|
||||||
if (cured.toLowerCase() === name.toLowerCase()) return
|
if (cured.toLowerCase() === name.toLowerCase()) return
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import parse from 'parse-duration'
|
import parse from 'parse-duration'
|
||||||
|
|
||||||
|
parse[''] = parse['s']!
|
||||||
|
parse['mo'] = parse['M'] = parse['month']!
|
||||||
|
|
||||||
const defaultUnitValue = parse['']!
|
const defaultUnitValue = parse['']!
|
||||||
|
|
||||||
export const parseDuration = (duration: string, defaultUnit?: parse.Units) => {
|
export const parseDuration = (duration: string, defaultUnit?: parse.Units) => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# 🏗️ Setting up the development environment
|
# 🏗️ Setting up the development environment
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> **This project uses [Bun](https://bun.sh) to run and bundle the code.**
|
> **This project uses [Bun](https://bun.sh) to run and bundle the code.**
|
||||||
> Compatibility with other runtimes (Node.js, Deno, ...) are not guaranteed and most package scripts won't work.
|
> Compatibility with other runtimes (Node.js, Deno, ...) are not guaranteed and most package scripts won't work.
|
||||||
|
|
||||||
To start developing, you'll need to set up the development environment first.
|
To start developing, you'll need to set up the development environment first.
|
||||||
@@ -11,8 +11,8 @@ To start developing, you'll need to set up the development environment first.
|
|||||||
2. Clone the mono-repository
|
2. Clone the mono-repository
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/revanced/revanced-helper.git &&
|
git clone https://github.com/revanced/revanced-bots.git &&
|
||||||
cd revanced-helper
|
cd revanced-bots
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Install dependencies
|
3. Install dependencies
|
||||||
|
|||||||
28
package.json
28
package.json
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "revanced-helper",
|
"name": "revanced-bots",
|
||||||
"description": "🤖 Bots assisting ReVanced on multiple platforms",
|
"description": "🤖 Bots assisting ReVanced on multiple platforms",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
@@ -15,13 +15,13 @@
|
|||||||
"flint:check": "biome check .",
|
"flint:check": "biome check .",
|
||||||
"clint": "commitlint --edit"
|
"clint": "commitlint --edit"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/revanced/revanced-helper#readme",
|
"homepage": "https://github.com/revanced/revanced-bots#readme",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/revanced/revanced-helper.git"
|
"url": "git+https://github.com/revanced/revanced-bots.git"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/revanced/revanced-helper/issues"
|
"url": "https://github.com/revanced/revanced-bots/issues"
|
||||||
},
|
},
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
"Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
||||||
@@ -29,23 +29,23 @@
|
|||||||
],
|
],
|
||||||
"packageManager": "bun@1.1.20",
|
"packageManager": "bun@1.1.20",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@anolilab/multi-semantic-release": "^1.1.3",
|
"@anolilab/multi-semantic-release": "^1.1.10",
|
||||||
"@biomejs/biome": "^1.9.3",
|
"@biomejs/biome": "^1.9.4",
|
||||||
"@codedependant/semantic-release-docker": "^5.0.3",
|
"@codedependant/semantic-release-docker": "^5.1.0",
|
||||||
"@commitlint/cli": "^19.5.0",
|
"@commitlint/cli": "^19.7.1",
|
||||||
"@commitlint/config-conventional": "^19.5.0",
|
"@commitlint/config-conventional": "^19.7.1",
|
||||||
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/exec": "^6.0.3",
|
"@semantic-release/exec": "^6.0.3",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
"@tsconfig/strictest": "^2.0.5",
|
"@tsconfig/strictest": "^2.0.5",
|
||||||
"@types/bun": "^1.1.11",
|
"@types/bun": "^1.2.4",
|
||||||
"conventional-changelog-conventionalcommits": "^7.0.2",
|
"conventional-changelog-conventionalcommits": "^7.0.2",
|
||||||
"lefthook": "^1.7.21",
|
"lefthook": "^1.11.2",
|
||||||
"portainer-service-webhook": "https://github.com/newarifrh/portainer-service-webhook#v1",
|
"portainer-service-webhook": "https://github.com/newarifrh/portainer-service-webhook#v1",
|
||||||
"semantic-release": "^24.1.2",
|
"semantic-release": "^24.2.3",
|
||||||
"turbo": "^2.1.3",
|
"turbo": "^2.4.4",
|
||||||
"typescript": "^5.6.3"
|
"typescript": "^5.8.2"
|
||||||
},
|
},
|
||||||
"trustedDependencies": [
|
"trustedDependencies": [
|
||||||
"@biomejs/biome",
|
"@biomejs/biome",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/revanced/revanced-helper.git",
|
"url": "git+https://github.com/revanced/revanced-bots.git",
|
||||||
"directory": "packages/api"
|
"directory": "packages/api"
|
||||||
},
|
},
|
||||||
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
],
|
],
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/revanced/revanced-helper/issues"
|
"url": "https://github.com/revanced/revanced-bots/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/revanced/revanced-helper#readme",
|
"homepage": "https://github.com/revanced/revanced-bots#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@revanced/bot-shared": "workspace:*",
|
"@revanced/bot-shared": "workspace:*",
|
||||||
"ws": "^8.18.0"
|
"ws": "^8.18.0"
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ export class ClientWebSocketManager {
|
|||||||
protected _toBuffer(data: RawData) {
|
protected _toBuffer(data: RawData) {
|
||||||
if (data instanceof Buffer) return data
|
if (data instanceof Buffer) return data
|
||||||
if (data instanceof ArrayBuffer) return Buffer.from(data)
|
if (data instanceof ArrayBuffer) return Buffer.from(data)
|
||||||
return Buffer.concat(data)
|
return Buffer.concat(data as Uint8Array[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/revanced/revanced-helper.git",
|
"url": "git+https://github.com/revanced/revanced-bots.git",
|
||||||
"directory": "packages/shared"
|
"directory": "packages/shared"
|
||||||
},
|
},
|
||||||
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
"author": "Palm <contact@palmdevs.me> (https://palmdevs.me)",
|
||||||
@@ -26,9 +26,9 @@
|
|||||||
],
|
],
|
||||||
"license": "GPL-3.0-or-later",
|
"license": "GPL-3.0-or-later",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/revanced/revanced-helper/issues"
|
"url": "https://github.com/revanced/revanced-bots/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/revanced/revanced-helper#readme",
|
"homepage": "https://github.com/revanced/revanced-bots#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bson": "^6.8.0",
|
"bson": "^6.8.0",
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.3.0",
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ export function serializePacket<TOp extends Operation>(packet: Packet<TOp>) {
|
|||||||
* @returns A packet
|
* @returns A packet
|
||||||
*/
|
*/
|
||||||
export function deserializePacket(buffer: Buffer) {
|
export function deserializePacket(buffer: Buffer) {
|
||||||
const data = BSON.deserialize(buffer)
|
const data = BSON.deserialize(buffer as Uint8Array)
|
||||||
return parse(PacketSchema, data) as Packet
|
return parse(PacketSchema, data) as Packet
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user