Revisions for ⁨Harmony bug report⁩

View the changes made to this paste.

unlisted ⁨1⁩ ⁨file⁩ 2021-08-10 17:39:29 UTC

bug example.ts

@@ -0,0 +1,49 @@

+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,
+]);
\ No newline at end of file