From 0fdf5d25289487bd7fd2cbec38db47e777a83b8b Mon Sep 17 00:00:00 2001 From: deepsarda <92147339+deepsarda@users.noreply.github.com> Date: Thu, 27 Oct 2022 20:00:59 +0530 Subject: [PATCH] feat(Amethyst): Update Docs (#2558) --- site/docs/amethyst/AmethystEmbed.md | 2 +- site/docs/amethyst/_category_.json | 2 +- site/docs/amethyst/exampleBot.md | 44 +++++++++++++++-------------- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/site/docs/amethyst/AmethystEmbed.md b/site/docs/amethyst/AmethystEmbed.md index 8a1a68dbf..f654b38d6 100644 --- a/site/docs/amethyst/AmethystEmbed.md +++ b/site/docs/amethyst/AmethystEmbed.md @@ -4,4 +4,4 @@ sidebar_position: 4 # Documentation [at][def] -[def]: https://deno.land/x/amethyst@v4.2.0/mod.ts?s=AmethystEmbed +[def]: https://deno.land/x/amethyst@v4.3.4/mod.ts?s=AmethystEmbed diff --git a/site/docs/amethyst/_category_.json b/site/docs/amethyst/_category_.json index e69147cb1..b564ff089 100644 --- a/site/docs/amethyst/_category_.json +++ b/site/docs/amethyst/_category_.json @@ -1 +1 @@ -{ "label": "Amethyst Framework", "position": 3 } +{ "label": "Amethyst Framework", "position": 4 } diff --git a/site/docs/amethyst/exampleBot.md b/site/docs/amethyst/exampleBot.md index d1e9437e3..a67b99f11 100644 --- a/site/docs/amethyst/exampleBot.md +++ b/site/docs/amethyst/exampleBot.md @@ -17,11 +17,10 @@ npm i @thereallonewolf/amethystframework - **Step 4**: Add following code in index.ts file, replacing TOKEN with your bot token. ```ts -import { ActivityTypes, Bot, createBot, GatewayIntents, startBot } from "discordeno"; +import {createBot, GatewayIntents, startBot } from "discordeno"; import { enableCachePlugin, enableCacheSweepers } from "discordeno/cache-plugin"; -import { AmethystBot, Context, enableAmethystPlugin } from "@thereallonewolf/amethystframework"; +import { AmethystBot, Context, enableAmethystPlugin, Event,Category, Command } from "@thereallonewolf/amethystframework"; -config(); let baseClient = createBot({ token: "TOKEN", intents: GatewayIntents.Guilds | GatewayIntents.GuildMessages | GatewayIntents.MessageContent, @@ -35,29 +34,32 @@ let client = enableAmethystPlugin(enableCachePlugin(baseClient), { }); enableCacheSweepers(client); -client.on("ready", () => { - console.log("I am up and running"); -}); +startBot(client); -client.amethystUtils.createCategory({ - name: "general", +@Category({ + name:"general", description: "My general commands", uniqueCommands: true, - default: "", -}); -client.amethystUtils.createCommand({ - name: "ping", - description: "Pong!", - commandType: ["application", "message"], - category: "general", - args: [], - async execute(bot: AmethystBot, ctx: Context) { + default: "", //As all the commands are unique so no need to set the default command. +}) +export class General { + @Command({ + name: "ping", + description: "Pong!", + commandType: ["application", "message"], + category: "general", + args: [], + }) + async ping(bot: AmethystBot, ctx: Context) { ctx.reply({ content: "Pong!" }); - }, -}); + } -client.amethystUtils.updateSlashCommands(); -startBot(client); + @Event("ready") + async ready() { + console.log("I am ready!"); + client.amethystUtils.updateSlashCommands(); + } +} ``` - **Step 5**: Invite your bot and compile index.ts and run it. Then you can use `/general ping` or `!ping`