feat: update scoring system and embed message structure

This commit is contained in:
2024-12-31 00:35:04 +09:00
parent 04dee350fc
commit 09ccb03626
4 changed files with 151 additions and 30 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
import { EmbedBuilder, MessageReaction, PartialMessageReaction } from 'discord.js';
export default function awardEmbed(reaction: MessageReaction | PartialMessageReaction) {
export default function awardEmbed(reaction: MessageReaction | PartialMessageReaction, score: number) {
function formatTime(time: Date) {
const yyyy = time.getFullYear();
const mm = time.getMonth().toString().padStart(2, '0');
@@ -18,7 +18,7 @@ export default function awardEmbed(reaction: MessageReaction | PartialMessageRea
.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}`,
name: `${reaction.message.reactions.cache.map((reaction) => `${reaction.emoji} x${reaction.count},`).join(' ')} / ${score.toFixed(1)}`,
value: `${reaction.message.url}${formatTime(reaction.message.createdAt)}\n-# ${reaction.message.id}`,
})
}