forked from Brycew73/CreatingAWebhook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusing-WebhookClient.mjs
More file actions
41 lines (37 loc) · 1.34 KB
/
using-WebhookClient.mjs
File metadata and controls
41 lines (37 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { config } from './config.mjs';
import { EmbedBuilder, WebhookClient } from 'discord.js';
const webhookClient = new WebhookClient({
id: config.webhookId,
token: config.webhookToken
});
const embed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Some title')
.setURL('https://discord.js.org/')
.setAuthor({
name: 'Some name',
iconURL: 'https://i.imgur.com/AfFp7pu.png',
url: 'https://discord.js.org' })
.setDescription('Some description here')
.setThumbnail('https://i.imgur.com/AfFp7pu.png')
.addFields(
{ name: 'Regular field title', value: 'Some value here' },
{ name: '\u200B', value: '\u200B' },
{ name: 'Inline field title', value: 'Some value here', inline: true },
{ name: 'Inline field title', value: 'Some value here', inline: true },
)
.addFields({
name: 'Inline field title',
value: 'Some value here',
inline: true })
.setImage('https://i.imgur.com/AfFp7pu.png')
.setTimestamp()
.setFooter({
text: 'Some footer text here',
iconURL: 'https://i.imgur.com/AfFp7pu.png' });
webhookClient.send({
content: 'This is some *remarkable* content!',
username: 'Oscar Winters',
avatarURL: 'https://pxl01-ycpedu.terminalfour.net/fit-in/540x540/filters:format(webp)/prod01/ycp-cdnpxl-media/media/york-website/offices-and-departments/giving/staff/winters.jpg',
embeds: [ embed ]
});