From faf36dcbbd29001ee8a3d8b0df2c24695c15486e Mon Sep 17 00:00:00 2001 From: Aki <71239005+AkiaCode@users.noreply.github.com> Date: Mon, 14 Dec 2020 22:24:53 +0900 Subject: [PATCH] Add Decorator --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index 1308f80..3bdbaa0 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,41 @@ client.commands.add(PingCommand) client.connect('super secret token comes here', Intents.All) ``` +Or with Decorator! +```ts +import { + CommandClient, + event, + Intents, + command, + CommandContext, +} from 'https://deno.land/x/harmony/mod.ts' + +class MyClient extends CommandClient { + constructor() { + super({ + prefix: ['!', '!!'], + caseSensitive: false + }) + } + + @event() + ready(): void { + console.log(`Logged in as ${this.user?.tag}!`) + } + + @command({ aliases: 'pong' }) + Ping(ctx: CommandContext): void { + ctx.message.reply('Pong!') + } +} + +// Connect to gateway +// Replace with your bot's token and intents (Intents.All, Intents.None, Intents.Presence, Intents.GuildMembers) +client.connect('super secret token comes here', Intents.All) +``` + + ## Docs Documentation is available for `main` (branch) and `stable` (release).