From 0a46aa5964ca5b4516840e4df8f9acc98829b24b Mon Sep 17 00:00:00 2001 From: BaumianerNiklas Date: Mon, 20 Sep 2021 20:57:21 +0200 Subject: [PATCH] refactor(*): type Snowflake -> string * as per https://github.com/discordjs/discord-api-types/pull/171 Snowflakes are now strings instead of stringified bigints --- src/events/ready.ts | 3 +-- src/structures/CommandHandler.ts | 4 ++-- src/util/constants.ts | 7 +++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/events/ready.ts b/src/events/ready.ts index 3457a2c..0023df1 100644 --- a/src/events/ready.ts +++ b/src/events/ready.ts @@ -1,6 +1,5 @@ import { BaseEvent } from "#structures/BaseEvent.js"; import type { WaddleBot } from "#structures/WaddleBot.js"; -import type { Snowflake } from "discord.js"; export class Event extends BaseEvent { constructor() { @@ -12,7 +11,7 @@ export class Event extends BaseEvent { async run(bot: WaddleBot) { if (process.argv[2] === "-D") { - bot.commandHandler.deploy(bot, (process.argv[3]?.toLowerCase() ?? "859164137187967006") as Snowflake); + bot.commandHandler.deploy(bot, process.argv[3]?.toLowerCase() ?? "859164137187967006"); } bot.user?.setPresence({ activities: [{ name: "being cute", type: "COMPETING" }] }); bot.logger.info(`Logged in as ${bot.user!.tag}.`); diff --git a/src/structures/CommandHandler.ts b/src/structures/CommandHandler.ts index 087b573..e40ddce 100644 --- a/src/structures/CommandHandler.ts +++ b/src/structures/CommandHandler.ts @@ -1,5 +1,5 @@ import type { ICommand, ICommandOption } from "#types"; -import { ApplicationCommandData, Collection, Snowflake } from "discord.js"; +import { ApplicationCommandData, Collection } from "discord.js"; import { join } from "path"; import { BaseCommand } from "#structures/BaseCommand.js"; import type { WaddleBot } from "./WaddleBot"; @@ -42,7 +42,7 @@ export class CommandHandler { this.APICommands = this.commands.map((c) => this.transformCommand(c)); } - public async deploy(bot: WaddleBot, destination: Snowflake | "global") { + public async deploy(bot: WaddleBot, destination: string) { if (!this.APICommands.length) this.registerAPICommands(); try { diff --git a/src/util/constants.ts b/src/util/constants.ts index b6004fa..3645b8e 100644 --- a/src/util/constants.ts +++ b/src/util/constants.ts @@ -1,10 +1,9 @@ -import type { Snowflake } from "discord-api-types"; import { Permissions } from "discord.js"; // Metainformation/Snowflakes -export const BOT_OWNER_ID = "337588047111520257" as Snowflake; -export const APPLICATION_ID = "723224456671002674" as Snowflake; -export const TESTING_GUILD = "859164137187967006" as Snowflake; +export const BOT_OWNER_ID = "337588047111520257"; +export const APPLICATION_ID = "723224456671002674"; +export const TESTING_GUILD = "859164137187967006"; // Colors export const COLOR_BOT = 0xf39c12;