define args discord
if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).trim().split(' '); const command = args.shift().toLowerCase();
define args discord
if (!message.content.startsWith(prefix) || message.author.bot) return; const args = message.content.slice(prefix.length).trim().split(' '); const command = args.shift().toLowerCase();
discord.js arguments
//Seperate Arguments let seperateArgs = args[0]; //0 being the first argument //Input "hello world" //Output "hello" //Full Arguments let fullArgs = args.slice(0).join(' '); //Input "hello world" //Output "hello world"
how to define args using param discord.js
const prefix = "!"; const args = message.content.substring(prefix.length).split(" ")
args slice discord.js
const args = message.content.slice(prefix.length).trim().split(/ +/g); const command = args.shift().toLowerCase(); if (command === "RandomCommand") { let firstArgs = args[0]; //first argument let secondArgs = args[1]; //second argument if (firstArgs && secondArgs) { //check if the args are existing message.channel.send(firstArgs, secondArgs) //send the value of the args } }
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us