Conversation
export_1783153248310.mov |
# Conflicts: # config.json.js
|
are we adding taxes |
drtheodor
left a comment
There was a problem hiding this comment.
make sure everything uses pings instead of plain name mentions and messages use format templates from config as other commands do
as for "could be its own function" comments, all of them could be extracted into a single function and use a single format template from the config
| default: { | ||
| switch (sub) { | ||
| case "wage": return await handleWage(interaction); | ||
| case "inflation": return await handleInflation(interaction); |
There was a problem hiding this comment.
same argument as for "add-item" and "remove-item"
There was a problem hiding this comment.
do you mean for wage and inflation or just inflation?
| if (interaction.isButton() || interaction.isModalSubmit()) { | ||
| const ic = interaction.customId.indexOf(":"); | ||
| handlerId = interaction.customId.substring(0, ic); | ||
| } else if (interaction.isChatInputCommand() || interaction.isAutocomplete()) { |
There was a problem hiding this comment.
why did you remove that
the autocomplete is used for autocompletion
like the thing needed for /economy buy
drtheodor
left a comment
There was a problem hiding this comment.
instead of storing all shop items in the db only store the ones that are limited amount and only store their id
all shop items should be dictated by the config and nothing else (inflation command has to go)
also make sure inventory items get killed if they no longer exist in the config
| .addTextDisplayComponents( | ||
| new TextDisplayBuilder().setContent("🛒 **The Server Shop**\nThe shop is currently empty.") | ||
| ); | ||
| return void await interaction.reply({ |
There was a problem hiding this comment.
shouldnt this be editReply?
| } | ||
| } | ||
|
|
||
| await profile.save(); |
There was a problem hiding this comment.
balance is read then written back whole with no transactiof two commands at once overwrite eacehother
|
|
||
| } else { | ||
| if (interaction.member.roles.cache.has(item.roleId)) { | ||
| return void await interaction.editReply({ content: config.economy.shop.permRoleOwned }); |
There was a problem hiding this comment.
shouldnt this be done with six twelve
| content: format(config.economy.roulette.openMessage, { userId: interaction.user.id, seconds: customSeconds }) | ||
| }); | ||
|
|
||
| const thread = await initialReply.startThread({ |
There was a problem hiding this comment.
wrap it so it cant be ran inside of a thread and causes a crash or without create bread perms
|
|
||
| slash: (builder) => { | ||
| return builder | ||
| .setName("economy") |
There was a problem hiding this comment.
set contexts to guild only
| import rnd from "~/util/rnd"; | ||
| import config from "config.json"; // Update to "../config.json.js" or "~/config.json" if your compiler requires it | ||
| import { randomInt } from "crypto"; | ||
| import { paginate } from "~/util/paginator2"; // FIX: Removed .ts and updated to project path mapping alias |
| return `${visualName} x\`${item.quantity}\``; | ||
| }).join("\n"); | ||
|
|
||
| // FIX: Combined everything into a clean, markdown-formatted plain text string |
| .setName("buy") | ||
| .setDescription("Purchase an item from the shop") | ||
| .addStringOption((opt) => opt.setName("item").setDescription("The ID of the item you want to buy (e.g. 'vip_role')").setRequired(true).setAutocomplete(true)) | ||
| .addIntegerOption((opt) => opt.setName("quantity").setDescription("How many to buy?").setMinValue(1)) |
| const shopItems = config.economy.shopItems || []; | ||
|
|
||
| if (sub === "buy" || sub === "refill") { | ||
| const filtered = shopItems.filter(item => |
There was a problem hiding this comment.
sold out items still show in autocomplete
| const json = container.toJSON(); | ||
| if (json.components) { | ||
| json.components.forEach((comp: any) => { | ||
| if (comp.type === 9 && comp.accessory && comp.accessory.type === 2) { |
There was a problem hiding this comment.
what are these magic numbers
added gambling money etc