Scorekeeper command output formatting changes.

This commit is contained in:
jrmyr 2025-04-30 02:13:32 +00:00
parent 2ddedbcc27
commit 5c3ee39fa6
3 changed files with 21 additions and 9 deletions

View File

@ -7,8 +7,12 @@ export const init = async (client, config) => {
// Skip if not in a guild // Skip if not in a guild
if (!message.guild) return; if (!message.guild) return;
// Add input points based on message length // Calculate input points: 1 point per character, plus 10 points per attachment
const points = Math.min(Math.ceil(message.content.length / 10), 5); const textPoints = message.content.length;
const attachmentPoints = message.attachments.size * 10;
const points = textPoints + attachmentPoints;
// Do not award zero or negative points
if (points <= 0) return;
try { try {
await client.scorekeeper.addInput(message.guild.id, message.author.id, points); await client.scorekeeper.addInput(message.guild.id, message.author.id, points);
} catch (error) { } catch (error) {

View File

@ -418,11 +418,12 @@ export const commands = [
// Wrap score retrieval and embed generation in try/catch to handle errors gracefully // Wrap score retrieval and embed generation in try/catch to handle errors gracefully
try { try {
// Fetch score data // Fetch score data and compute multiplier
const baseOutput = client.config.scorekeeper.baseOutput; const baseOutput = client.config.scorekeeper.baseOutput;
const commendationValue = client.config.scorekeeper.commendationValue; const commendationValue = client.config.scorekeeper.commendationValue;
const citationValue = client.config.scorekeeper.citationValue; const citationValue = client.config.scorekeeper.citationValue;
const scoreData = await client.scorekeeper.getScore(interaction.guildId, targetUser.id); const scoreData = await client.scorekeeper.getScore(interaction.guildId, targetUser.id);
const multiplierValue = 1 + (scoreData.commendations * commendationValue) - (scoreData.citations * citationValue);
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(`I/O Score for ${(await interaction.guild.members.fetch(targetUser.id).catch(() => null))?.displayName || targetUser.username}`) .setTitle(`I/O Score for ${(await interaction.guild.members.fetch(targetUser.id).catch(() => null))?.displayName || targetUser.username}`)
.setColor(0x00AE86) .setColor(0x00AE86)
@ -434,6 +435,13 @@ export const commands = [
{ name: 'Input Score', value: `**${scoreData.input}**`, inline: true }, { name: 'Input Score', value: `**${scoreData.input}**`, inline: true },
{ name: 'Output Score', value: `**${scoreData.output}** + ${baseOutput}`, inline: true } { name: 'Output Score', value: `**${scoreData.output}** + ${baseOutput}`, inline: true }
) )
.addFields({
name: 'Formula',
value:
`M = 1 + **${scoreData.commendations}** * ${commendationValue} - **${scoreData.citations}** * ${citationValue}\n` +
`M × **${scoreData.input}** / (**${scoreData.output}** + ${baseOutput}) = **${scoreData.totalScore.toFixed(2)}**`,
inline: false
})
.setFooter({ text: 'Last decay: ' + new Date(scoreData.lastDecay).toLocaleDateString() }) .setFooter({ text: 'Last decay: ' + new Date(scoreData.lastDecay).toLocaleDateString() })
.setTimestamp(); .setTimestamp();

View File

@ -4,7 +4,7 @@ Role:
Manager of the Continental, an upscale, exclusive hotel catering to a discerning clientele. Manager of the Continental, an upscale, exclusive hotel catering to a discerning clientele.
Physical Description: Physical Description:
An anthropomorphic crow. Impeccably groomed, slender build, sharp, angular features, always dressed in a tailored black suit with a crisp white shirt, black tie, and polished shoes. Feathers neatly arranged, piercing black eyes, and a calm, measured posture. An anthropomorphic raven. Impeccably groomed, slender build, sharp, angular features, always dressed in a tailored black suit with a crisp white shirt, black tie, and polished shoes. Feathers neatly arranged, piercing black eyes, and a calm, measured posture.
Personality & Mannerisms: Personality & Mannerisms:
Exudes the poise and precision of an English butler. Speaks in a soft, controlled tone with perfect diction. Movements are deliberate, economical, and elegant. Never rushed, never flustered. Maintains unwavering composure and subtle authority in all situations. Exudes the poise and precision of an English butler. Speaks in a soft, controlled tone with perfect diction. Movements are deliberate, economical, and elegant. Never rushed, never flustered. Maintains unwavering composure and subtle authority in all situations.