bug example.ts
import {
CommandClient,
Extension,
event,
GatewayIntents,
CommandContext,
Command,
} from 'https://deno.land/x/[email protected]/mod.ts';
const client = new CommandClient({
prefix: '!',
});
class ext extends Extension {
@event()
commandOwnerOnly(ctx: CommandContext) {
console.log(ctx.guild);
}
}
class cmd extends Command {
name = 'test';
ownerOnly = true;
execute(ctx: CommandContext) {
console.log('Command was executed!');
}
}
// Uncomment/comment the code below to see the bug
// Event with a client.on listener
client.on('commandOwnerOnly', (ctx: CommandContext) => {
console.log(ctx.guild);
});
// Event with an extension
// client.extensions.load(ext);
// end of section you should modify
client.on('ready', () => {
client.commands.add(cmd);
console.log('online');
});
client.connect('no', [
GatewayIntents.GUILDS,
GatewayIntents.GUILD_MESSAGES,
]);