From 176d3c0ba7a8acf8175bc123a223461b79f96cbb Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Fri, 25 Mar 2022 10:58:39 +0000 Subject: [PATCH] fix: beginner template --- .gitignore | 2 +- template/beginner/configs.ts | 19 +++++++++++++++++++ template/beginner/deps.ts | 9 +++------ template/beginner/src/types/commands.ts | 4 ++-- 4 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 template/beginner/configs.ts diff --git a/.gitignore b/.gitignore index 6f9690650..76f79e23f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Allows quick testing of changes and keeps stuff like tokens private debug.ts -configs.ts +./configs.ts .env # npm stuff diff --git a/template/beginner/configs.ts b/template/beginner/configs.ts new file mode 100644 index 000000000..7119cd627 --- /dev/null +++ b/template/beginner/configs.ts @@ -0,0 +1,19 @@ +import { dotEnvConfig } from "./deps.ts"; + +// Get the .env file that the user should have created, and get the token +const env = dotEnvConfig({ export: true }); +const token = env.BOT_TOKEN || ""; + +export interface Config { + token: string; + botId: bigint; +} + +export const configs = { + /** Get token from ENV variable */ + token, + /** Get the BotId from the token */ + botId: BigInt(atob(token.split(".")[0])), + /** The server id where you develop your bot and want dev commands created. */ + devGuildId: BigInt(env.DEV_GUILD_ID!), +}; diff --git a/template/beginner/deps.ts b/template/beginner/deps.ts index ce11c8354..f68d94301 100644 --- a/template/beginner/deps.ts +++ b/template/beginner/deps.ts @@ -1,12 +1,9 @@ -export * from "https://deno.land/x/discordeno@13.0.0-rc18/mod.ts"; +export * from "https://deno.land/x/discordeno@13.0.0-rc27/mod.ts"; +export * from "https://deno.land/x/discordeno@13.0.0-rc27/plugins/mod.ts"; + // Terminal Colors! export * from "https://deno.land/std@0.117.0/fmt/colors.ts"; // Get data from .env files export { config as dotEnvConfig } from "https://deno.land/x/dotenv@v3.1.0/mod.ts"; // Database, thx Tri! export * from "https://deno.land/x/kwik@v1.2.1/mod.ts"; - -// All the Plugins -export * from "https://deno.land/x/discordeno_cache_plugin@0.0.21/mod.ts"; -export * from "https://deno.land/x/discordeno_permissions_plugin@0.0.15/mod.ts"; -export * from "https://deno.land/x/discordeno_helpers_plugin@0.0.8/mod.ts"; diff --git a/template/beginner/src/types/commands.ts b/template/beginner/src/types/commands.ts index acef7d5c7..d817920ab 100644 --- a/template/beginner/src/types/commands.ts +++ b/template/beginner/src/types/commands.ts @@ -1,5 +1,5 @@ import { BotClient } from "../../bot.ts"; -import { ApplicationCommandOption, ApplicationCommandTypes, DiscordenoInteraction } from "../../deps.ts"; +import { ApplicationCommandOption, ApplicationCommandTypes, Interaction } from "../../deps.ts"; export interface Command { /** The name of this command. */ @@ -13,5 +13,5 @@ export interface Command { /** The options for this command */ options?: ApplicationCommandOption[]; /** This will be executed when the command is run. */ - execute: (bot: BotClient, interaction: DiscordenoInteraction) => unknown; + execute: (bot: BotClient, interaction: Interaction) => unknown; }