mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-11 13:56:15 +00:00
feat(bots/discord): improve logs
This commit is contained in:
@@ -18,7 +18,7 @@ on('disconnect', (reason, msg) => {
|
||||
|
||||
// TODO: move to config
|
||||
if (api.disconnectCount >= 3) {
|
||||
console.error(new Error('Disconnected from bot API too many times'))
|
||||
console.error('Disconnected from bot API too many times')
|
||||
// We don't want the process hanging
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ export const getResponseFromContent = async (
|
||||
|
||||
// If none of the regexes match, we can search for labels immediately
|
||||
if (!response && !ocrMode) {
|
||||
logger.debug('No match from before regexes, doing NLP')
|
||||
const scan = await api.client.parseText(content)
|
||||
if (scan.labels.length) {
|
||||
const matchedLabel = scan.labels[0]!
|
||||
@@ -82,7 +83,8 @@ export const getResponseFromContent = async (
|
||||
}
|
||||
|
||||
// If we still don't have a label, we can match all regexes after the initial label trigger
|
||||
if (!response)
|
||||
if (!response) {
|
||||
logger.debug('No match from NLP, doing after regexes')
|
||||
for (let i = 0; i < config.responses.length; i++) {
|
||||
const { triggers, response: resp } = config.responses[i]!
|
||||
const firstLabelIndex = firstLabelIndexes[i] ?? -1
|
||||
@@ -99,6 +101,7 @@ export const getResponseFromContent = async (
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
response,
|
||||
|
||||
Reference in New Issue
Block a user