chore: apply code fixes with biome

This commit is contained in:
PalmDevs
2023-11-28 22:03:41 +07:00
parent c80bd068fa
commit f2d85c32a4
32 changed files with 1384 additions and 1383 deletions

View File

@@ -1,43 +1,43 @@
import { ClientOperation, ServerOperation } from '@revanced/bot-shared'
import { inspect as inspectObject } from 'node:util'
import type { EventHandler } from './index.js'
const parseTextEventHandler: EventHandler<ClientOperation.ParseText> = async (
packet,
{ witClient, logger }
) => {
const {
client,
d: { text, id },
} = packet
logger.debug(`Client ${client.id} requested to parse text:`, text)
try {
const { intents } = await witClient.message(text, {})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const intentsWithoutIds = intents.map(({ id, ...rest }) => rest)
await client.send({
op: ServerOperation.ParsedText,
d: {
id,
labels: intentsWithoutIds,
},
})
} catch (e) {
await client.send({
op: ServerOperation.ParseTextFailed,
d: {
id,
},
})
if (e instanceof Error) logger.error(e.stack ?? e.message)
else logger.error(inspectObject(e))
}
}
export default parseTextEventHandler
import { ClientOperation, ServerOperation } from '@revanced/bot-shared'
import { inspect as inspectObject } from 'node:util'
import type { EventHandler } from './index.js'
const parseTextEventHandler: EventHandler<ClientOperation.ParseText> = async (
packet,
{ witClient, logger },
) => {
const {
client,
d: { text, id },
} = packet
logger.debug(`Client ${client.id} requested to parse text:`, text)
try {
const { intents } = await witClient.message(text, {})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const intentsWithoutIds = intents.map(({ id, ...rest }) => rest)
await client.send({
op: ServerOperation.ParsedText,
d: {
id,
labels: intentsWithoutIds,
},
})
} catch (e) {
await client.send({
op: ServerOperation.ParseTextFailed,
d: {
id,
},
})
if (e instanceof Error) logger.error(e.stack ?? e.message)
else logger.error(inspectObject(e))
}
}
export default parseTextEventHandler