Skip to content

Commit

Permalink
fix: crash when using commands in dm
Browse files Browse the repository at this point in the history
  • Loading branch information
AkatGabrielGoncalves committed Nov 2, 2023
1 parent 561350c commit a8b0b42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/modules/CommandHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommandInteraction, Message, PermissionsBitField } from 'discord.js';
import { ChannelType, CommandInteraction, Message, PermissionsBitField } from 'discord.js';
import { getChannelAuths } from '../database/queries/channelAuth';
import { getServer } from '../database/queries/server';
import Logger from '../logger/Logger';
Expand Down Expand Up @@ -49,7 +49,7 @@ export class CommandHandler extends CommandPermissionsHandler {
};

public readonly message = async (message: Message) => {
if (message.author.bot) return null;
if (message.author.bot || message.channel.type === ChannelType.DM) return null;

const guildId = message.guildId as string;

Expand All @@ -67,7 +67,7 @@ export class CommandHandler extends CommandPermissionsHandler {
};

public readonly interaction = async (interaction: CommandInteraction) => {
if (!interaction.isChatInputCommand()) return;
if (!interaction.isChatInputCommand() || !interaction.guild) return;

const guildId = interaction.guildId as string;

Expand Down

0 comments on commit a8b0b42

Please sign in to comment.