Skip to content

Commit

Permalink
Add slash command warning and ignore > chat prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
SunburntRock89 committed May 17, 2023
1 parent f5fd313 commit 190238a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/events/messageCreate.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import { Message } from "discord.js";
import { EmbedBuilder, Message } from "discord.js";
import { blacklistCache } from "../database/db";
import DTelClient from "../internals/client";
import config from "../config/config";

export default async(client: DTelClient, message: Message): Promise<void> => {
if (message.author.id === client.user!.id || blacklistCache.get(message.author.id)) return; // Don't cause loopback & ignore blacklist

const call = client.calls.find(c => c.to.channelID === message.channel.id || c.from.channelID === message.channel.id);
if (!call) return; // We don't need to handle messages we have nothing to do with
if (!call) {
if (message.content.startsWith(">ping") || message.content.startsWith(">call") || message.content.startsWith(">dial") || message.content.startsWith(">rdial")) {
const embed = new EmbedBuilder()
.setColor(config.colors.info)
.setTitle("DTel has moved to Slash Commands!")
.setDescription(`Type \`/\` in the chat to view the available commands. If you need help, please join our [support server](${config.guildInvite})!`);
message.reply({
embeds: [embed],
});
}
return;
} // We don't need to handle messages we have nothing to do with

call.messageCreate(message);
};
2 changes: 1 addition & 1 deletion src/internals/callClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ export default class CallClient implements CallsWithNumbers {
}

async messageCreate(message: Message): Promise<void> {
if (!this.pickedUp?.by) return;
if (!this.pickedUp?.by || message.content.startsWith(">")) return;
const sideToSendTo = this.getOtherSideByChannel(message.channel.id)!;

const toSend = await this.processContent(message, sideToSendTo);
Expand Down

0 comments on commit 190238a

Please sign in to comment.