Code
JavaScript
x
32
32
1
module.exports.run = async (bot, message, args) =>{
2
3
// at the top of your file
4
const discord = require('discord.js');
5
const config = require("../config");
6
7
// inside a command, event listener, etc.
8
const embed = new discord.MessageEmbed()
9
.setColor('RANDOM')
10
.setTitle('Créditos do Os Profissionais')
11
.setURL('https://discord.gg/')
12
.setAuthor('Effy', 'https://i.imgur.com/wSTFkRM.png', 'https://stackoverflow.com/users/15303029/meredithgrey')
13
.setDescription('Criador do grupo e desenvolvedor do BOT')
14
.setThumbnail('https://i.imgur.com/1oHJJZQ.png')
15
.addFields(
16
{ name: 'Créditos de equipe', value: 'Equipe gestora' },
17
{ name: 'u200B', value: 'u200B' },
18
{ name: 'Snoot', value: 'Owner', inline: true },
19
{ name: 'Texugo', value: 'Owner', inline: true },
20
)
21
.addField('Leo', 'Owner', true)
22
.setImage('https://i.imgur.com/1oHJJZQ.png')
23
.setTimestamp()
24
.setFooter(message.author.username, message.author.avatar);
25
26
message.channel.send(embed);
27
}
28
module.exports.config = {
29
name: "credits",
30
aliases: ["creditos"]
31
}
32
Error:
JavaScript
1
9
1
(node:5676) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
2
embed.footer.icon_url: Scheme "fbea7946b1cf05e3bfbff344733ba775" is not supported. Scheme must be one of ('http', 'https').
3
at RequestHandler.execute (C:UsersPcDesktopRemakeTOnode_modulesdiscord.jssrcrestRequestHandler.js:154:13)
4
at processTicksAndRejections (internal/process/task_queues.js:93:5)
5
at async RequestHandler.push (C:UsersPcDesktopRemakeTOnode_modulesdiscord.jssrcrestRequestHandler.js:39:14)
6
(Use `node --trace-warnings ...` to show where the warning was created)
7
(node:5676) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
8
(node:5676) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
9
Since when I started using discord.js V12 i walk with many doubts and one of them is, how to catch the avatar of a user? Can someone help me? I know it’s a stupid doubt but I really don’t know
Advertisement
Answer
message.author.avatar
is not a method. You need message.author.avatarURL
JavaScript
1
3
1
//author's avatar:
2
.setThumbnail(message.author.avatarURL);
3
As mentioned above, try using the docs