feat(Amethyst): Update Docs (#2558)

This commit is contained in:
deepsarda
2022-10-27 09:30:59 -05:00
committed by GitHub
parent 9d9ba4c251
commit 0fdf5d2528
3 changed files with 25 additions and 23 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -1 +1 @@
{ "label": "Amethyst Framework", "position": 3 }
{ "label": "Amethyst Framework", "position": 4 }
+23 -21
View File
@@ -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`