mirror of
https://gitlab.com/qwerinope/qweribot.git
synced 2026-02-04 09:26:58 +01:00
add economy command (so darkxoa for idea), streamer silverbullet doesn't get stored, minor blaster and silverbullet fixes
This commit is contained in:
22
src/commands/economy.ts
Normal file
22
src/commands/economy.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { getTotalItemCounts } from "db/dbUser";
|
||||
import itemAliasMap from "items";
|
||||
import { Command, sendMessage } from "lib/commandUtils";
|
||||
|
||||
export default new Command({
|
||||
name: "economy",
|
||||
aliases: ["economy", "eco"],
|
||||
usertype: "chatter",
|
||||
execution: async (msg) => {
|
||||
const allitems = await getTotalItemCounts();
|
||||
const itemList = Object.entries(allitems)
|
||||
.sort(([, a], [, b]) => b - a)
|
||||
.map(([item, count]) => {
|
||||
const itemobj = itemAliasMap.get(item);
|
||||
if (itemobj) return `${itemobj.prettyName}: ${count}`;
|
||||
return `${item}: ${count}`; // Fallback if an item doesn't have their name as an alias
|
||||
})
|
||||
.join(" | ");
|
||||
|
||||
await sendMessage(`Total Items in circulation: ${itemList}`, msg.messageId);
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user