#How to get the text from a MESSAGE argument ?

2 messages · Page 1 of 1 (latest)

stable sedge
#

Hello i'm trying to make a command but can't find a way to get the string from the Message type argument, here is my code :

event.register(
        Commands.literal('setCompetences').requires((s) => s.hasPermission(2))
    .then(
        Commands.argument("player",Arguments.PLAYER.create(event))
        .then(
            Commands.argument("competences",Arguments.MESSAGE.create(event)).executes(
            c => {
                let player = Arguments.PLAYER.getResult(c, "player")
                /** @type {Internal.Message} */
                let competences = Arguments.MESSAGE.getResult(c, "competences");
                c.source.player.sendSystemMessage(typeof competences);
                competences = competences.getText()
                competences.split(" ");
                competences = convertTextToInt(competences);
                if (!setCompetences(player, competencesListe)){
                    console.error("Il manque un argument")
                    return 0
                }
                return 1
            })
    )));
spare jackalBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!