Skip to content

Commit

Permalink
refactor(*): type Snowflake -> string
Browse files Browse the repository at this point in the history
* as per discordjs/discord-api-types#171 Snowflakes are now strings instead of stringified bigints
  • Loading branch information
BaumianerNiklas committed Sep 20, 2021
1 parent 6cd2d9e commit 0a46aa5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/events/ready.ts
Original file line number Diff line number Diff line change
@@ -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() {
Expand All @@ -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}.`);
Expand Down
4 changes: 2 additions & 2 deletions src/structures/CommandHandler.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 3 additions & 4 deletions src/util/constants.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 0a46aa5

Please sign in to comment.