items now display emojis for stats

This commit is contained in:
MasterTemple
2023-01-05 16:33:29 -08:00
parent ffb53a79ca
commit 371cca0f3d
4 changed files with 13 additions and 11 deletions

View File

@@ -25,4 +25,6 @@ LUDB_HQ_VALID_ONLY=false
# the number of decimals to round to when showing drop rates
LUDB_DECIMAL_PLACES=4
# the roles required to perform certain commands such as /reload, can be separated by any non digit delimeter
LUDB_ADMIN_ROLES="1058802658804236410"
LUDB_ADMIN_ROLES="1058802658804236410"
# custom emojis used by the bot "name_1,id_1;name_2,id_2;"
LUDB_CUSTOM_EMOJIS="armor,820200969861857280;life,820200969803268096;imagination,820200969789767690"

View File

@@ -17,3 +17,4 @@ export const footerIcon = env.LUDB_FOOTER_ICON;
export const HQValidOnly = env.LUDB_HQ_VALID_ONLY === "true" ? true : false;
export const decimalPlaces = parseInt(env.LUDB_DECIMAL_PLACES);
export const adminRoles = [...env.LUDB_ADMIN_ROLES.match(/\d+/g) || []];
export const customEmojis = ([...env.LUDB_CUSTOM_EMOJIS.matchAll(/(?<name>\w+),(?<id>\d+)/gim)] || []).map((m) => m.groups);

View File

@@ -1,5 +1,5 @@
import { Client } from 'discord.js';
import { dropHomeRow, itemHomeRow } from '../components';
import { customEmojis } from '../config';
import { notFound } from '../error';
import { getOption, replyOrUpdate } from '../functions';
import { Embed } from '../types/Embed';
@@ -10,11 +10,12 @@ const ARMOR_EMOJI = "1060367206422163566";
const LIFE_EMOJI = "1060367241205514291";
const IMAGINATION_EMOJI = "1060367253134131342";
function emojiStats(client: Client, count: number, name: string, id: string) {
function emojiStats(count: number, name: string, id: string) {
let str = "";
// let emoji = client.emojis.cache.get("305818615712579584");
for (let i = 0; i < count; i++) {
str += `<a:${name}:${id}> `;
str += `<:${name}:${id}> `;
// str += ` ${emoji}`;
// str += `:${id}:`;
// str += ":heart:";
@@ -60,11 +61,11 @@ export default {
if (item.stats) {
// embed.addField("Armor", ":ARMOR_EMOJI:", true);
embed.addField("Health", item.stats.health.toString(), true);
embed.addField("Imagination", item.stats.imagination.toString(), true);
// embed.addField("Armor", emojiStats(interaction.client, item.stats.armor, "ARMOR_EMOJI", ARMOR_EMOJI), true);
// embed.addField("Health", emojiStats(interaction.client, item.stats.health, "LIFE_EMOJI", LIFE_EMOJI), true);
// embed.addField("Imagination", emojiStats(interaction.client, item.stats.imagination, "IMAGINATION_EMOJI", IMAGINATION_EMOJI), true);
// embed.addField("Health", item.stats.health.toString(), true);
// embed.addField("Imagination", item.stats.imagination.toString(), true);
embed.addField("Armor", emojiStats(item.stats.armor, "armor", customEmojis.find(({ name }) => name === "armor")["id"]), true);
embed.addField("Health", emojiStats(item.stats.health, "life", customEmojis.find(({ name }) => name === "life")["id"]), true);
embed.addField("Imagination", emojiStats(item.stats.imagination, "imagination", customEmojis.find(({ name }) => name === "imagination")["id"]), true);
}
embed.addField("Cost", item.itemComponent.buyPrice.toString(), true);
@@ -74,7 +75,6 @@ export default {
else {
embed.addField("Not an Item!", `${item.name} is not an item!`);
}
embed.setDescription(emojiStats(interaction.client, item.stats.armor, "ARMOR_EMOJI", ARMOR_EMOJI));
await replyOrUpdate({
interaction: interaction,
embeds: [embed],

View File

@@ -35,7 +35,6 @@ export class Mission extends CDClient {
async addThumbnail(id: number = this.id): Promise<void> {
this.imageURL = `${explorerDomain}${await this.getIconAssetForMission(id)}`;
console.log(this.imageURL);
}
organizeData() {