From 2c6d11e77f1fe5db0bddceb68d155511dd15b875 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Tue, 3 Mar 2026 18:56:58 +0000 Subject: [PATCH 01/11] Update itemdict.json by modifying entries Removed 'mata' entry and renamed 'miat' to 'miata' in item dictionary. --- data/itemdict.json | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/data/itemdict.json b/data/itemdict.json index aa20774..b572ec0 100644 --- a/data/itemdict.json +++ b/data/itemdict.json @@ -491,13 +491,6 @@ "single": true, "last_edited_by": "crooooww" }, - "mata": { - "cost": -1, - "name": "remove", - "emoji": "", - "single": false, - "last_edited_by": "keebaque" - }, "kbh": { "cost": 10000000, "name": "Kahoobb's Soul", @@ -505,7 +498,7 @@ "single": true, "last_edited_by": "hxperant" }, - "miat": { + "miata": { "cost": 10000, "name": "1989 Mazda Miata MX-5", "emoji": ":red_car:", @@ -575,4 +568,4 @@ "single": true, "last_edited_by": "toxicmaximalist" } -} \ No newline at end of file +} From d5df9bd4ddc5b6c0f347c09a1dbbc2c4aa72ad6b Mon Sep 17 00:00:00 2001 From: Keebaque Date: Tue, 3 Mar 2026 18:59:15 +0000 Subject: [PATCH 02/11] Update income message to reflect gross income Also changed text to be more specific --- commands/mine.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/mine.js b/commands/mine.js index eac327d..fd418d1 100644 --- a/commands/mine.js +++ b/commands/mine.js @@ -111,7 +111,7 @@ async function mine(message, args) { energy_string = `${watts.toFixed(0)} Wh`; } - const message_string = `Your hashrate is ${hash_rate.toFixed(4)} TH/s, and your expected income each ${period} is ${(net_income).toFixed(8)} BTC. Using ${energy_string} costing ${(electricity_cost).toFixed(8)} BTC, your expected net is ${(net_income).toFixed(8)} BTC.`; + const message_string = `Your hashrate is ${hash_rate.toFixed(4)} TH/s, and your expected gross income each ${period} is ${(gross_income).toFixed(8)} BTC. Using ${energy_string} costing ${(electricity_cost).toFixed(8)} BTC, your expected net income is ${(net_income).toFixed(8)} BTC.`; message.channel.send(message_string); } @@ -123,4 +123,4 @@ module.exports = { mine: { execute: mine } -}; \ No newline at end of file +}; From 37e585b84c5b12f035bbd0ca7ed33e11667dafd3 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Wed, 4 Mar 2026 21:28:42 +0000 Subject: [PATCH 03/11] Revert previous item changes --- data/itemdict.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/data/itemdict.json b/data/itemdict.json index b572ec0..e42f064 100644 --- a/data/itemdict.json +++ b/data/itemdict.json @@ -498,7 +498,14 @@ "single": true, "last_edited_by": "hxperant" }, - "miata": { + "mata": { + "cost": -1, + "name": "remove", + "emoji": "", + "single": false, + "last_edited_by": "keebaque" + }, + "miat": { "cost": 10000, "name": "1989 Mazda Miata MX-5", "emoji": ":red_car:", From fb20a1dd4731ff15cd0e634a9b4a989130e320b3 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Wed, 4 Mar 2026 21:30:09 +0000 Subject: [PATCH 04/11] wrong spot :P --- data/itemdict.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/data/itemdict.json b/data/itemdict.json index e42f064..6e34c27 100644 --- a/data/itemdict.json +++ b/data/itemdict.json @@ -491,13 +491,6 @@ "single": true, "last_edited_by": "crooooww" }, - "kbh": { - "cost": 10000000, - "name": "Kahoobb's Soul", - "emoji": ":hearts:", - "single": true, - "last_edited_by": "hxperant" - }, "mata": { "cost": -1, "name": "remove", @@ -505,6 +498,13 @@ "single": false, "last_edited_by": "keebaque" }, + "kbh": { + "cost": 10000000, + "name": "Kahoobb's Soul", + "emoji": ":hearts:", + "single": true, + "last_edited_by": "hxperant" + }, "miat": { "cost": 10000, "name": "1989 Mazda Miata MX-5", From ea50ca6b00afd2ccbe0ce5af5ce35fa07114269b Mon Sep 17 00:00:00 2001 From: Keebaque Date: Wed, 4 Mar 2026 23:23:10 +0000 Subject: [PATCH 05/11] Add deleteItem function to remove items by code --- services/items.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/services/items.js b/services/items.js index e3f9bfa..b98565f 100644 --- a/services/items.js +++ b/services/items.js @@ -56,6 +56,28 @@ function saveItem(code, name, price, mode, lastEditedBy, emoji = "", pricingType return `Successfully ${mode === "add" ? "added" : "edited"} item: ${name} with value $${cost}`; } +/** + * Removes an item. + * @param {string} code - The unique calling code (3-4 characters). + * @returns {string} Result message, either success or an error. + */ +function deleteItem(code) { + // Check if the memo exists + if (!code || code.length < 3 || code.length > 9) { + return "Please use a calling code that is 3-9 characters."; + } + + const itemExists = Object.prototype.hasOwnProperty.call(ITEM_DICT, code.toLowerCase()); + if (!itemExists) { + return `The calling code ${code} does not exist. Use the !additem command or an existing code.`; + } + + // Remove the memo from the store + delete ITEM_DICT[code.toLowerCase()]; + save(ITEM_DICT, FILEPATH); + return `Successfully removed item: ${code}`; +} + /** * Edits the price of an existing item. * @param {string} code - The calling code of the item. @@ -126,4 +148,4 @@ function getAllItems() { return Object.keys(ITEM_DICT); } -module.exports = { saveItem, editItemPrice, getItemPrice, isSingleItem, formatItem, getAllItems } \ No newline at end of file +module.exports = { saveItem, editItemPrice, getItemPrice, isSingleItem, formatItem, getAllItems } From 2245ddbdec5457e2bfc256f1d669c15ba35fcbec Mon Sep 17 00:00:00 2001 From: Keebaque Date: Wed, 4 Mar 2026 23:54:00 +0000 Subject: [PATCH 06/11] Implement deleteItem function in items.js Add deleteItem function to handle item deletion. --- commands/items.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/commands/items.js b/commands/items.js index db167a7..048df7b 100644 --- a/commands/items.js +++ b/commands/items.js @@ -47,6 +47,21 @@ async function editItem(message, args) { return; } +async function deleteItem(message, args) { + if (!(await checkDataEdit(message))) return; // No permission + + if (args.length != 1) { + await message.channel.send( + "The edititem command requires 1 parameter: the calling code of the item (3 characters please)"); + return; + } + + const output = deleteItem(args[0]); + + await message.channel.send(output); + return; +} + async function editPrice(message, args) { if (!(await checkDataEdit(message))) return; // No permission @@ -72,4 +87,4 @@ module.exports = { editprice: { execute: editPrice } -} \ No newline at end of file +} From 4aa3e716242f58aac7f51c824d266aaa94d392c1 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Mon, 9 Mar 2026 19:48:33 +0000 Subject: [PATCH 07/11] Rename deleteItem function to removeItem, add import --- commands/items.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/items.js b/commands/items.js index 048df7b..7c6ab1a 100644 --- a/commands/items.js +++ b/commands/items.js @@ -1,4 +1,4 @@ -const { saveItem, editItemPrice } = require("../services/items.js"); +const { saveItem, deleteItem, editItemPrice } = require("../services/items.js"); const { checkDataEdit } = require("../utils/discordutils.js"); async function addItem(message, args) { @@ -47,7 +47,7 @@ async function editItem(message, args) { return; } -async function deleteItem(message, args) { +async function removeItem(message, args) { if (!(await checkDataEdit(message))) return; // No permission if (args.length != 1) { From 40a43307f759a22f6afea938e9f2299bcd4ba273 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Tue, 10 Mar 2026 00:19:47 +0000 Subject: [PATCH 08/11] Add removeitem command to module exports --- commands/items.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/items.js b/commands/items.js index 7c6ab1a..e59ba92 100644 --- a/commands/items.js +++ b/commands/items.js @@ -84,6 +84,9 @@ module.exports = { edititem: { execute: editItem }, + removeitem: { + execute: removeItem + }, editprice: { execute: editPrice } From dd33adea6110f67a5778eb4bdd7a44e103db6b85 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Tue, 10 Mar 2026 00:26:26 +0000 Subject: [PATCH 09/11] Add deleteItem to module exports in items.js --- services/items.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/items.js b/services/items.js index b98565f..8dd2f3d 100644 --- a/services/items.js +++ b/services/items.js @@ -148,4 +148,4 @@ function getAllItems() { return Object.keys(ITEM_DICT); } -module.exports = { saveItem, editItemPrice, getItemPrice, isSingleItem, formatItem, getAllItems } +module.exports = { saveItem, deleteItem, editItemPrice, getItemPrice, isSingleItem, formatItem, getAllItems } From de0787a2155410c1a05b971dadbc1ea48fd9c776 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Tue, 10 Mar 2026 00:40:47 +0000 Subject: [PATCH 10/11] fixed docstring for deleteitem --- services/items.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/items.js b/services/items.js index 8dd2f3d..04d8268 100644 --- a/services/items.js +++ b/services/items.js @@ -58,7 +58,7 @@ function saveItem(code, name, price, mode, lastEditedBy, emoji = "", pricingType /** * Removes an item. - * @param {string} code - The unique calling code (3-4 characters). + * @param {string} code - The unique calling code (3-9 characters). * @returns {string} Result message, either success or an error. */ function deleteItem(code) { From ca17cc6405c07e8bc6f58d8c5dac729d540f9877 Mon Sep 17 00:00:00 2001 From: Keebaque Date: Wed, 11 Mar 2026 21:16:10 +0000 Subject: [PATCH 11/11] empty commit?