master
parent
9a92db91bd
commit
7ec30c5b19
|
@ -13,6 +13,10 @@ export default class CommandHandler extends Event {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async run(message: Message) {
|
public async run(message: Message) {
|
||||||
|
const transaction = Sentry.startTransaction({ name: 'command-handler' });
|
||||||
|
Sentry.configureScope((scope) => {
|
||||||
|
scope.setSpan(transaction);
|
||||||
|
});
|
||||||
try {
|
try {
|
||||||
this.client.db.mongo.Stat.updateOne({ name: 'messages' }, { $inc: { value: 1 } }).exec();
|
this.client.db.mongo.Stat.updateOne({ name: 'messages' }, { $inc: { value: 1 } }).exec();
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
@ -28,12 +32,9 @@ export default class CommandHandler extends Event {
|
||||||
}
|
}
|
||||||
this.client.util.signale.log(`User '${message.author.username}#${message.author.discriminator}' ran command '${resolved.cmd.name}' in '${message.channel.id}'.`);
|
this.client.util.signale.log(`User '${message.author.username}#${message.author.discriminator}' ran command '${resolved.cmd.name}' in '${message.channel.id}'.`);
|
||||||
try {
|
try {
|
||||||
const transaction = Sentry.startTransaction({ name: 'command-handler' });
|
const span = transaction.startChild({ op: 'Command.run' });
|
||||||
Sentry.configureScope((scope) => {
|
|
||||||
scope.setSpan(transaction);
|
|
||||||
});
|
|
||||||
await resolved.cmd.run(message, resolved.args);
|
await resolved.cmd.run(message, resolved.args);
|
||||||
transaction.finish();
|
span.finish();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.client.util.handleError(err, message, resolved.cmd);
|
this.client.util.handleError(err, message, resolved.cmd);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -42,5 +43,6 @@ export default class CommandHandler extends Event {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.client.util.handleError(err, message);
|
this.client.util.handleError(err, message);
|
||||||
}
|
}
|
||||||
|
transaction.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue