mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 06:03:04 -04:00
add maintower logging to interaction commands
This commit is contained in:
parent
177a9cd990
commit
265c8793ca
1 changed files with 34 additions and 0 deletions
|
@ -158,6 +158,40 @@ commandClient.on('commandRunError', async ({context, error}) => {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
interactionClient.on('commandRunError', async ({context, error}) => {
|
||||
try{
|
||||
// Log the error via our maintower service
|
||||
let packages = {
|
||||
data: {},
|
||||
origin: {},
|
||||
meta: {
|
||||
shard: context.shardId.toString(),
|
||||
cluster: context.manager.clusterId.toString()
|
||||
}
|
||||
}
|
||||
|
||||
if(context.user) packages.origin.user = { name: `${context.user.username}#${context.user.discriminator}`, id: context.user.id }
|
||||
if(context.guild) packages.origin.guild = { name: context.guild.name, id: context.guild.id }
|
||||
if(context.channel) packages.origin.channel = { name: context.channel.name, id: context.channel.id }
|
||||
|
||||
packages.data.command = context.command.name
|
||||
packages.data.error = error ? error.stack || error.message : error
|
||||
if(error.raw) packages.data.raw = JSON.stringify(error.raw, null, 2)
|
||||
|
||||
let req = await maintower(packages, "01")
|
||||
|
||||
await editOrReply(context, {
|
||||
content: `${icon("cross")} Something went wrong while attempting to run this command. (Reference: \`${req}\`)`
|
||||
})
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
await editOrReply(context, {
|
||||
content: `${icon("cross")} Something went wrong while attempting to run this command.`
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
(async () => {
|
||||
|
||||
// Logging
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue