change message with cool embed
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { EmbedBuilder, MessageReaction, PartialMessageReaction } from 'discord.js';
|
||||
|
||||
export default function awardEmbed(reaction: MessageReaction | PartialMessageReaction) {
|
||||
function formatTime(time: Date) {
|
||||
const yyyy = time.getFullYear();
|
||||
const mm = time.getMonth().toString().padStart(2, '0');
|
||||
const dd = time.getDate().toString().padStart(2, '0');
|
||||
const hh = time.getHours().toString().padStart(2, '0');
|
||||
const MM = time.getMinutes().toString().padStart(2, '0');
|
||||
return `${yyyy}-${mm}-${dd} ${hh}:${MM}`;
|
||||
}
|
||||
return new EmbedBuilder()
|
||||
.setColor(0x777777)
|
||||
.setAuthor({
|
||||
name: reaction.message.author?.displayName || "unknown",
|
||||
iconURL: reaction.message.author?.avatarURL() || undefined,
|
||||
})
|
||||
.setDescription(reaction.message.content || null)
|
||||
.setThumbnail(reaction.message.attachments.filter((attachment) => !(!attachment.height && !attachment.width)).first()?.url || null)
|
||||
.addFields({
|
||||
name: `${reaction.emoji.name} x${reaction.count} `,
|
||||
value: `in <#${reaction.message.channelId}> • ${formatTime(reaction.message.createdAt)}\n-# ${reaction.message.id}`,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user