21 |
22 |
23 | ```ts
24 | import {
25 | NaticoClient,
26 | NaticoClientOptions,
27 | NaticoCommandHandler
28 | } from "https://deno.land/x/natico/mod.ts";
29 | class BotClient extends NaticoClient {
30 | constructor(public options: NaticoClientOptions) {
31 | super(options);
32 | }
33 | commandHandler: NaticoCommandHandler = new NaticoCommandHandler(this, {
34 | directory: "./commands",
35 | prefix: "!",
36 | });
37 | async start() {
38 | await this.commandHandler.loadALL();
39 | return this.login();
40 | }
41 | }
42 | const botClient = new BotClient({
43 | intents: ["Guilds", "GuildMessages", "GuildVoiceStates"],
44 | token: "your token",
45 | });
46 | botClient.start();
47 | ```
48 |
49 | you will have to apply the plugins manually using the naticoclient.plugn() function
50 |
51 |
52 | |
53 |
54 |
55 |
56 | ```ts
57 | import { enableNaticoPlugin, NaticoBot, NaticoPluginOptions, withPlugins } from "../src/plugins/NaticoPlugin.ts";
58 | import { enableCachePlugin, enableCacheSweepers } from "https://deno.land/x/discordeno_cache_plugin@0.0.9/mod.ts";
59 |
60 | const pluginOps: NaticoPluginOptions = {
61 | commandHandler: {
62 | directory: "examples/template/commands",
63 | prefix: "!",
64 | },
65 | };
66 |
67 | const bot = withPlugins>(
68 | //@ts-ignore -
69 | {
70 | token: Deno.env.get("DISCORD_TOKEN")!,
71 | intents: ["Guilds", "GuildMessages"],
72 | botId: BigInt(Deno.env.get("BOT_ID")!),
73 | cache: {
74 | isAsync: false,
75 | },
76 | },
77 | [enableNaticoPlugin, pluginOps],
78 | enableCachePlugin,
79 | enableCacheSweepers
80 | );
81 | async function startUp() {
82 | await bot.commandHandler.loadALL();
83 | return await bot.login();
84 | }
85 | startUp();
86 | ```
87 |
88 | |
89 |
90 |