let args = message.content.slice(config.prefix.length).split(' ');
let command = args.shift().toLowerCase();
let tellJoke = randomNumber(4);
if (debounce == true){
return
}
debounce = true
switch (command) {
case 'gameid':
console.log(args.length)
if(args.length == 1){
let placeId = args[1]
console.log(placeId)
api = await fetch("https://api.roblox.com/universes/get-universe-containing-place?placeid=" + placeId)
let gameId = await api.json()
try{
if(api){
reply = await message.reply('Game Id: ' + gameId.UniverseId)
debounce = false
break;
}
}catch(error){
reply = await message.reply('Something went wrong. ERROR: ' + error);
debounce = false
break;
}
}
reply = await message.reply('Something went wrong. Did you write the command correctly?')
debounce = false
return
It says placeId/arg 1 is undefined when I clearly put the place id there. Does anyone know why this is happening? I've printed/logged the args and length of it and I can say that it should work.
args.length == 1thenargs[1]is undefined.args[0]is the first element in an array (and the only element in an array of length 1).