Hi i have problem with using guild on my discord bot. Whenever i want to return the amount of the users on my server i recive this error
if (typeof data !== 'string') throw new error(errorMessage);
RangeError [MESSAGE_CONTENT_TYPE]: Message content must be a non-empty string.
if (cmd === `name`) { //This is working when used on discord text-channel
msg.reply(msg.guild.name)
}
if (cmd === `users`) { //This is not working when used on discord text-channel
msg.reply(msg.guild.memberCount)
}
The memberCount property returns a number which you are trying to send in a channel. The problem is that sending a number is not allowed. Your message content must always be a string.
You can solve this problem by using the String function to send a number. Your command will look like this:
if(cmd === `users`){
msg.reply(String(msg.guild.memberCount));
}