remove @ symbols from command args so you can @qwerinope

This commit is contained in:
2025-07-23 21:48:25 +01:00
parent 83d9a1f070
commit 2244bbce5b

View File

@@ -2,13 +2,13 @@ import { commandPrefix } from "..";
/** Helper function to extract arguments from commands */ /** Helper function to extract arguments from commands */
export default function parseCommandArgs(input: string) { export default function parseCommandArgs(input: string) {
const nice = input.toLowerCase().slice(commandPrefix.length).trim(); const nice = input.toLowerCase().slice(commandPrefix.length).trim().replace(/[@]/g, '');
const sliceLength = nice.startsWith('use') ? 2 : 1; const sliceLength = nice.startsWith('use') ? 2 : 1;
return nice.split(' ').slice(sliceLength); return nice.split(' ').slice(sliceLength);
}; };
export function parseCheerArgs(input: string) { export function parseCheerArgs(input: string) {
const nice = input.toLowerCase().trim(); const nice = input.toLowerCase().trim().replace(/[@]/g, '');
// This is for the test command. Remove the command prefix, the command, the whitespace after and the amount of fake bits // This is for the test command. Remove the command prefix, the command, the whitespace after and the amount of fake bits
if (nice.startsWith(commandPrefix + 'testcheer')) return nice.slice(commandPrefix.length + 'testcheer'.length + 1).split(' ').slice(1); if (nice.startsWith(commandPrefix + 'testcheer')) return nice.slice(commandPrefix.length + 'testcheer'.length + 1).split(' ').slice(1);