So I have a serverinfo command that shows your server info but I would like to get also other servers info by using the server id in your 2nd args. But it shows only mine and even if I have a 2nd args it does the same.
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
var Guild = message.guild + bot.guilds.get(args[1])
var Myguild = message.guild;
if (!args[1] == null)
message.channel.send("Invallid")
var embed = new Discord.RichEmbed()
.setColor("#c59c16")
.setAuthor(Myguild.name, Myguild.iconURL || Guild.name, Guild.iconURL)
.setThumbnail(Myguild.iconURL || Guild.iconURL)
.addField("Name", Myguild.name || Guild.name, true)
.addField("Owner", Myguild.owner || Guild.owner, true)
.addField("Region", Myguild.region || Guild.region, true)
.addField("ID", Myguild.id || Guild.id, true)
.addField("Members", Myguild.memberCount || Guild.memberCount, true)
.addField("Bots", Myguild.members.filter(member => member.user.bot).size || Guild.members.filter(member => member.user.bot).size, true)
.addField("Voice channels", Myguild.channels.filter(chan => chan.type === 'voice').size || Guild.channels.filter(chan => chan.type === 'voice').size, true)
.addField("Text channels", Myguild.channels.filter(chan => chan.type === 'text').size || Guild.channels.filter(chan => chan.type === 'text').size, true)
.addField("Roles", Myguild.roles.map(r => r.name).join(" , ") || Guild.roles.map(r => r.name).join(" , "))
.setFooter("Created: " + Myguild.createdAt || Guild.createdAt)
message.channel.sendEmbed(embed);
}
module.exports.help = {
name: "serverinfo"
}
that's because you're using the + operator instead of || operator, your Guild variable needs to be replaced with var Guild = message.guild || bot.guilds.get(args[1])
Myguild.iconURL()- SyntleMyguild.iconURLis right but it says it's not a well formed URL, that's caused by the fact you tried using theGuild.nameas a URL value, you need to removeGuild.name +leave it asMyguild.iconURL || Guild.iconURL- Syntle