Skip to content

Commit

Permalink
Improve trim for wiki searching
Browse files Browse the repository at this point in the history
  • Loading branch information
gausie committed Nov 19, 2023
1 parent 2c790be commit 2bef265
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/commands/wiki/wiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ export async function execute(interaction: ChatInputCommandInteraction) {
});
}

const trim = (message) =>
message.replace(/^[*_\s]+/, "").replace(/[*_\s]+$/, "");

async function onMessage(message: Message) {
if (message.author.bot) return;
if (!("send" in message.channel)) return;
Expand All @@ -74,7 +77,7 @@ async function onMessage(message: Message) {
let slashNote = "";
if (
matches.length > 0 &&
matches[0][0] === message.content.trim() &&
matches[0][0] === trim(message.content) &&
message.type !== MessageType.Reply
) {
try {
Expand Down

0 comments on commit 2bef265

Please sign in to comment.