From 571796962306549fec16dc52286c693734b118b4 Mon Sep 17 00:00:00 2001 From: DjDeveloperr Date: Sat, 7 Nov 2020 14:44:28 +0530 Subject: [PATCH] Add Command Client usage in README --- README.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/README.md b/README.md index 0602170..891df9b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ **An easy to use Discord API Library for Deno.** * Lightweight and easy to use. +* Built-in Command Framework, + * Easily build Commands on the fly. + * Compltely Customizable. + * Complete Object-Oriented approach. * 100% Discord API Coverage. * Customizable caching. * Built in support for Redis. @@ -55,6 +59,35 @@ client.on('messageCreate', (msg: Message): void => { client.connect('super secret token comes here', Intents.All) ``` +Or with CommandClient! +```ts +import { CommandClient, Command, CommandContext, Message, Intents } from 'https://raw.githubusercontent.com/discord-deno/discord.deno/main/mod.ts' + +const client = new CommandClient({ + prefix: '!' +}) + +// Listen for event when client is ready (Identified through gateway / Resumed) +client.on('ready', () => { + console.log(`Ready! User: ${client.user?.tag}`) +}) + +// Create a new Command +class PingCommand extends Command { + name = "ping" + + execute(ctx: CommandContext) { + ctx.message.reply(`pong! Ping: ${ctx.client.ping}ms`) + } +} + +client.commands.add(PingCommand) + +// Connect to gateway +// Replace with your bot's token and intents (Intents.All, Intents.Presence, Intents.GuildMembers) +client.connect('super secret token comes here', Intents.All) +``` + ## Docs Not made yet.