Compare commits
1
Commits
v1.1.1
...
8709af48f8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8709af48f8 |
@@ -1,13 +1,41 @@
|
|||||||
import type { Message } from "discord.js";
|
import { EmbedBuilder, type Message } from "discord.js";
|
||||||
import type { Command } from "../service";
|
import type { Command } from "../service";
|
||||||
import { api } from "../../../util";
|
import { api } from "../../../util";
|
||||||
|
|
||||||
|
const ATTRIBUTE_EMOJI: Record<string, string> = {
|
||||||
|
Strength: "💪",
|
||||||
|
Power: "⚡",
|
||||||
|
Endurance: "🏃",
|
||||||
|
Agility: "🤸",
|
||||||
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "stats",
|
name: "stats",
|
||||||
description: "View your fitness statistics!",
|
description: "View your fitness statistics!",
|
||||||
execute: async (message: Message) => {
|
execute: async (message: Message) => {
|
||||||
const res = await api.accounts({ id: `@${message.author.id}` }).stats.get();
|
const res = await api.accounts({ id: `@${message.author.id}` }).stats.get();
|
||||||
const stats = res.data;
|
if (!res.data) {
|
||||||
console.log(stats);
|
await message.reply("No stats found yet — submit an assessment first!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { player, attributes } = res.data;
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setColor(0xE74C3C)
|
||||||
|
.setTitle(`${message.author.username}'s Stats`)
|
||||||
|
.setThumbnail(message.author.displayAvatarURL())
|
||||||
|
.setDescription(`**Overall Level: ${player}**`)
|
||||||
|
.addFields(
|
||||||
|
Object.entries(attributes).map(([attribute, level]) => ({
|
||||||
|
name: `${ATTRIBUTE_EMOJI[attribute] ?? ""} ${attribute}`,
|
||||||
|
value: `Level ${level}`,
|
||||||
|
inline: true,
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
.setFooter({ text: "Blade & Brawn" })
|
||||||
|
.setTimestamp();
|
||||||
|
|
||||||
|
await message.reply({ embeds: [embed] });
|
||||||
}
|
}
|
||||||
} as Command;
|
} as Command;
|
||||||
|
|||||||
Reference in New Issue
Block a user