Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/commandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class CommandHandler {
private readonly commands: Map<string[], Command>;
private readonly help: string;

constructor(private readonly production: boolean) {
constructor() {
const availableCommands = new Array<string>();

this.commands = new Map(
Expand Down Expand Up @@ -70,15 +70,12 @@ export default class CommandHandler {

/** Executes user commands contained in a message if appropriate. */
async handleCommandInteraction(interaction: Interaction): Promise<void> {
if (!this.production) {
const msg = `Buggie bot received ${JSON.stringify(
interaction,
(_, v) => (typeof v === "bigint" ? `${v.toString()}n` : v),
4
)} from '${interaction.user.tag}`;
// await interaction.channel?.send(msg);
console.log(msg);
}
const msg = `Buggie bot received ${JSON.stringify(
interaction,
(_, v) => (typeof v === "bigint" ? `${v.toString()}n` : v),
4
)} from '${interaction.user.tag}`;
console.log(msg);

if (!interaction.isCommand()) throw new Error("Invalid command interaction");

Expand Down
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import Discord, {
Partials,
} from "discord.js";
import CommandHandler from "@/commandHandler";
import config from "@/config/botConfig";
import { env } from "@/config/env";

process.on("unhandledRejection", reason => {
Expand All @@ -31,7 +30,7 @@ const client = new Discord.Client({
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});

const commandHandler = new CommandHandler(config.production);
const commandHandler = new CommandHandler();

client.once(Events.ClientReady, () => {
if (client.user != null) {
Expand Down
Loading