admin管理员组

文章数量:1355047

I've been trying to show the server's icon in the serverinfo embed, but it won't show up.

var serverIcon = message.guild.iconURL;
const serverInfoEmbed = new Discord.MessageEmbed()
  .setTitle('server info')
  .setColor(0x348a58)
  .addField('owner', message.guild.owner, true)
  .addField('name', '`' + message.guild.name + '`', true)
  .addField('members', '`' + message.guild.memberCount + '`', true)
  .setThumbnail(serverIcon)
  .setFooter('very bootiful server');

setTimeout(() => { message.channel.send(serverInfoEmbed) }, 200);
console.log(serverIcon);

in the console, it says:

[Function: iconURL]

I tried to put it directly as the thumbnail .setThumbnail(message.guild.iconURL) but it still didn't work.

I've been trying to show the server's icon in the serverinfo embed, but it won't show up.

var serverIcon = message.guild.iconURL;
const serverInfoEmbed = new Discord.MessageEmbed()
  .setTitle('server info')
  .setColor(0x348a58)
  .addField('owner', message.guild.owner, true)
  .addField('name', '`' + message.guild.name + '`', true)
  .addField('members', '`' + message.guild.memberCount + '`', true)
  .setThumbnail(serverIcon)
  .setFooter('very bootiful server');

setTimeout(() => { message.channel.send(serverInfoEmbed) }, 200);
console.log(serverIcon);

in the console, it says:

[Function: iconURL]

I tried to put it directly as the thumbnail .setThumbnail(message.guild.iconURL) but it still didn't work.

Share Improve this question edited Jun 8, 2020 at 18:37 Syntle 5,1743 gold badges15 silver badges34 bronze badges asked Jun 8, 2020 at 16:22 froggitfroggit 891 gold badge2 silver badges10 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

It's because guild.iconURL() is a function, and you would need to replace your line :

var serverIcon = message.guild.iconURL;

with :

var serverIcon = message.guild.iconURL();

I also suggest you to read the docs for more info :)

本文标签: javascriptDiscordjsguildiconURL not working in embedStack Overflow