-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmbed.ts
36 lines (31 loc) · 1.14 KB
/
Embed.ts
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
import { Client, ColorResolvable, CommandInteraction, EmbedAuthorData, EmbedBuilder, EmbedField, EmbedFooterData } from 'discord.js';
import Colors from './EmbedColors';
import process from 'process';
export default (
client: Client,
interaction: CommandInteraction,
title: string,
description: string,
color?: ColorResolvable,
fields?: EmbedField[],
url?: string,
author?: EmbedAuthorData,
thumbnail?: string,
image?: string,
footer?: EmbedFooterData
) => {
const embed = new EmbedBuilder()
.setTitle(title)
.setDescription(description)
.setColor(color ?? Colors.Green);
if (url) embed.setURL(url);
if (author) embed.setAuthor(author);
if (thumbnail) embed.setThumbnail(thumbnail);
if (fields) embed.setFields(fields);
if (image) embed.setImage(image);
embed.setFooter(footer ?? {
iconURL: client.user.avatarURL(),
text: `Server Monitor • PID: ${process.pid}, Shard ID: ${interaction.guild.shardId}, Uptime: ${Math.floor((client.uptime / 1000) / 60)} mins, Latency: ${Date.now() - interaction.createdTimestamp} ms`
});
return embed;
};