2024-11-19 20:05:19 -05:00
|
|
|
import settings from '../settings.js'
|
|
|
|
import version from '../version.js'
|
|
|
|
import { bots } from '../index.js'
|
|
|
|
import botVersion from '../util/version.js'
|
2024-11-07 02:33:43 -05:00
|
|
|
import chatlog from '../util/chatlog.js'
|
|
|
|
|
2024-11-19 20:05:19 -05:00
|
|
|
process.on('uncaughtException', (e, o) => {
|
|
|
|
for (const i in bots) {
|
|
|
|
try {
|
|
|
|
bots[i].ccq[0] = `/tellraw ${version.botAuthor} ${
|
2024-11-07 02:33:43 -05:00
|
|
|
JSON.stringify({
|
2024-11-19 20:05:19 -05:00
|
|
|
translate: '%s\n',
|
2024-11-07 02:33:43 -05:00
|
|
|
color: settings.colors.fatalError,
|
|
|
|
with: [
|
|
|
|
`An error occured and ${version.botName} will now shut down.`
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}`
|
|
|
|
bots[i].advanceccq()
|
2024-11-19 20:05:19 -05:00
|
|
|
const stack = e.stack.split('\n')
|
|
|
|
for (const item of stack) {
|
|
|
|
bots[i].ccq[0] = `/tellraw ${version.botAuthor} ${
|
2024-11-07 02:33:43 -05:00
|
|
|
JSON.stringify({
|
|
|
|
text: item,
|
|
|
|
color: settings.colors.fatalError
|
|
|
|
})
|
|
|
|
}`
|
|
|
|
bots[i].advanceccq()
|
|
|
|
}
|
2024-11-19 20:05:19 -05:00
|
|
|
bots[i].ccq[0] = `/tellraw ${version.botAuthor} ${
|
2024-11-07 02:33:43 -05:00
|
|
|
JSON.stringify({
|
2024-11-19 20:05:19 -05:00
|
|
|
translate: '\n%s',
|
2024-11-07 02:33:43 -05:00
|
|
|
color: settings.colors.fatalError,
|
|
|
|
with: [
|
|
|
|
[
|
2024-11-19 20:05:19 -05:00
|
|
|
'Additional info:\n',
|
2024-11-07 02:33:43 -05:00
|
|
|
`Bot version: ${botVersion}`
|
|
|
|
]
|
|
|
|
]
|
|
|
|
})
|
|
|
|
}`
|
|
|
|
bots[i].advanceccq() // Force the command queue to advance
|
|
|
|
} catch (e) {}
|
|
|
|
}
|
2024-11-19 20:05:19 -05:00
|
|
|
chatlog('error', e.stack)
|
2024-11-07 02:33:43 -05:00
|
|
|
console.error(e)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
|
|
|
|
|
|
|
export default function load (b) {
|
|
|
|
// Due to the nature of this plugin, it does not need to do anything at the bot level
|
2024-11-19 20:05:19 -05:00
|
|
|
}
|