add ctx handling to command handler
parent
903f918678
commit
bb039360a0
|
@ -1,7 +1,7 @@
|
||||||
/* eslint-disable no-useless-return */
|
/* eslint-disable no-useless-return */
|
||||||
import { Message, TextChannel, NewsChannel } from 'eris';
|
import { Message, TextChannel, NewsChannel } from 'eris';
|
||||||
import * as Sentry from '@sentry/node';
|
import * as Sentry from '@sentry/node';
|
||||||
import { Client, Event } from '../class';
|
import { Client, CmdContext, Event } from '../class';
|
||||||
|
|
||||||
export default class CommandHandler extends Event {
|
export default class CommandHandler extends Event {
|
||||||
public client: Client;
|
public client: Client;
|
||||||
|
@ -29,7 +29,7 @@ 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 span = transaction.startChild({ op: 'Command.run' });
|
const span = transaction.startChild({ op: 'Command.run' });
|
||||||
await resolved.cmd.run(message, resolved.args);
|
await resolved.cmd.run(new CmdContext(message, resolved.args));
|
||||||
span.finish();
|
span.finish();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.client.util.handleError(err, message, resolved.cmd);
|
this.client.util.handleError(err, message, resolved.cmd);
|
||||||
|
|
Loading…
Reference in New Issue