Passa al contenuto principale

Economy

A simple economy system, containing a shop system, message-drops and commands to earn money.

Economy
A simple economy-system, containing a shop system, message-drops and commands to earn money
This module is open-source.
This module is storing data in your bot's database.
This module has 2 configuration files.
This module is being actively used on over 6300 other servers on SCNX.
This module is included for free in every plan. Learn more about prices.

Features

  • Users can earn virtual currency through working, committing crimes, collecting daily and weekly rewards, and message drops.
  • A banking system allows users to deposit and withdraw funds for safekeeping.
  • Rob other users to steal a percentage of their balance.
  • A shop system where users can buy roles with their earned currency.
  • Shop managers can create, edit, and delete shop items.
  • An auto-updating leaderboard shows the wealthiest users.
  • Message drops randomly reward users with currency when chatting.
  • Users can toggle message drop notifications on or off.
  • Admin commands to add, remove, or set user balances (optional, can be disabled for fairness).

Setup

  1. Optionally configure a leaderboard channel and a shop channel in the module configuration -- the bot will send and maintain auto-updating embeds in these channels.
  2. Make sure the bot has View Channel, Send Messages, Embed Links, and Manage Messages permissions in the leaderboard and shop channels.
  3. If using the shop system with role rewards, ensure the bot has the Manage Roles permission and its role is above the rewarded roles.
  4. Configure currency name, symbol, and earning parameters in the module configuration.

Usage

Users can interact with the economy using the /economy command:

  • Earn currency: Use /economy work, /economy crime, /economy daily, or /economy weekly to earn money. Each command has its own configurable cooldown.
  • Rob users: Use /economy rob to steal a percentage of another user's balance (capped at a configurable maximum).
  • Check balance: Use /economy balance to view your own or another user's balance, bank, and total.
  • Banking: Use /economy deposit and /economy withdraw to move funds between your balance and bank. Use "all" as the amount to transfer everything.
  • Message drops: Toggle drop notifications with /economy msg_drop_msg enable or /economy msg_drop_msg disable.

Shop managers and administrators can manage the shop:

  • Use /shop add to create new items with a name, ID, price, and role reward.
  • Use /shop edit to modify existing items.
  • Use /shop delete to remove items.
  • Users can browse the shop with /shop list and purchase items with /shop buy.

If admin cheats are enabled, administrators can use /economy add, /economy remove, /economy set, and /economy destroy to manage user balances.

Commands

Understand the documentation
In these docs, name:<Type> is an option of a slash-command with name name and the type Type. Options that not required, are described as [name:<Type>]. If the action of a command is vastly different between required and not-required options, we might list them separately.
Examples
  • /moderate ban user:<Member>: This command (/moderate ban) has an required option with the name "user" that only accepts one member as a value.
  • /moderate ban victim:<Member> reason:<Text>: This command (/moderate ban) has an required option with the name "victim" that only accepts one member as a value and another required option with the name "reason" that accepts any text as an value.
  • /moderate ban victim:<Member> reason:<Text> [proof:<Attachment>]: This command (/moderate ban) has an required option with the name "victim" that only accepts one member as a value, another required option with the name "reason" that accepts any text as an value and a not-required option with the name "proof" which allows one attachment as its value.
CommandDescription
/economy workWork to earn a random amount of currency (within configured min/max range). Subject to cooldown.
/economy crimeAttempt a crime with a 50% chance of success. On success, earn currency; on failure, lose half your balance. Subject to cooldown.
/economy rob user:<User>Rob another user to steal a percentage of their balance, capped at a configured maximum. Subject to cooldown.
/economy dailyCollect your daily currency reward. Can be used once every 24 hours.
/economy weeklyCollect your weekly currency reward. Can be used once every 7 days.
/economy balance [user:<User>]View your own balance or another user's balance, bank, and total.
/economy deposit amount:<Text>Deposit currency from your balance into your bank. Use "all" to deposit everything.
/economy withdraw amount:<Text>Withdraw currency from your bank into your balance. Use "all" to withdraw everything.
/economy msg_drop_msg enableEnable message drop notifications for yourself.
/economy msg_drop_msg disableDisable message drop notifications for yourself (you will still earn drops, just without notifications).
/economy add user:<User> amount:<Integer>(Admin only) Add currency to a user's balance. Requires admin cheats to be enabled.
/economy remove user:<User> amount:<Integer>(Admin only) Remove currency from a user's balance. Requires admin cheats to be enabled.
/economy set user:<User> balance:<Integer>(Admin only) Set a user's balance to a specific amount. Requires admin cheats to be enabled.
/economy destroy [confirm:<Boolean>](Admin only) Destroy the entire economy, removing all user data, shop items, and cooldowns. Requires admin cheats to be enabled.
/shop add item-name:<Text> item-id:<Text> price:<Integer> role:<Role>(Shop manager only) Create a new shop item with a name, ID, price, and role reward.
/shop buy [item-name:<Text>] [item-id:<Text>]Purchase an item from the shop by name or ID. The role associated with the item will be granted.
/shop listView all available items in the shop.
/shop delete [item-name:<Text>] [item-id:<Text>](Shop manager only) Delete a shop item by name or ID.
/shop edit item-id:<Text> [item-new-name:<Text>] [new-price:<Integer>] [new-role:<Role>](Shop manager only) Edit an existing shop item's name, price, or role.

Configuration

This module has multiple configuration files. Please review them below.

Module configuration

In this configuration file, you can configure the functionality of this module. Open it in your dashboard.

FieldDescription
AdministratorsUser IDs of economy administrators who can perform admin-only actions such as managing user balances. Bot operators always have this permission.
allowCheatsAllow administrators to edit user balances. Not recommended for a fair system.
selfBalanceAllow administrators to edit their own balance. Not recommended.
shop-managersUser IDs of shop managers who can create, edit, and delete shop items. Bot operators always have this permission.
Start MoneyThe amount of currency given to new users when they first interact with the economy.
currency nameThe name of your virtual currency.
Symbol of the currencyThe symbol or emoji displayed alongside currency amounts.
max work moneyThe maximum amount of currency earnable from a single work command.
min work moneyThe minimum amount of currency earnable from a single work command.
work cooldownThe cooldown duration (in minutes) between uses of the work command.
max crime moneyThe maximum amount of currency earnable from a successful crime.
min crime moneyThe minimum amount of currency earnable from a successful crime.
crime cooldownThe cooldown duration (in minutes) between uses of the crime command.
max rob amountThe maximum amount of currency that can be stolen in a single rob.
rob percentThe percentage of a user's balance that can be stolen in a rob.
rob cooldownThe cooldown duration (in minutes) between uses of the rob command.
leaderboard-channelThe channel where the auto-updating leaderboard embed will be displayed. Leave empty to disable.
shop channelThe channel where the shop embed will be displayed. Leave empty to disable.
message-drops ignored channelsChannels where message drops are disabled.
messageDropsThe chance to receive a message drop (1 in this value). Set to 0 to disable message drops.
messageDropsMaxThe maximum amount of currency in a message drop.
messageDropsMinThe minimum amount of currency in a message drop.
dailyRewardThe amount of currency given for the daily reward.
weeklyRewardThe amount of currency given for the weekly reward.
Public Command-RepliesIf enabled, command responses will be visible to everyone instead of only the command user.

Module messages

In this configuration file, you can customize the messages sent by this module. Open it in your dashboard.

FieldDescription
not found messageMessage shown when a shop item cannot be found.
not enough moneyMessage shown when a user does not have enough currency to buy an item.
shop messageThe embed displayed in the shop channel showing all available items.
item stringThe format used for each item in the shop message.
cooldownMessage shown when a user attempts to use a command while on cooldown.
workSuccessArray of messages randomly shown when a user successfully works.
crimeSuccessArray of messages randomly shown when a user successfully commits a crime.
crimeFailArray of messages randomly shown when a user fails at committing a crime.
robSuccessMessage shown when a user successfully robs another user.
leaderboardEmbedCustomize the appearance of the leaderboard embed.
dailyRewardMessage shown when a user collects their daily reward.
weeklyRewardMessage shown when a user collects their weekly reward.
balanceReplyThe embed displayed when a user checks their balance.
userNotFoundMessage shown when the specified user cannot be found.
buyMsgMessage shown when a user purchases a shop item.
itemCreateMessage shown when a shop item is created.
itemDeleteMessage shown when a shop item is deleted.
itemEditMessage shown when a shop item is edited.
deposit messageMessage shown when a user deposits currency to the bank.
withdraw messageMessage shown when a user withdraws currency from the bank.
message drop messageArray of messages shown when a user receives a message drop.
rebuy messageMessage shown when a user tries to buy an item they already own.
multiple matchesMessage shown when multiple shop items match the search query.
no matchesMessage shown when no shop item matches the search query.
item duplicateMessage shown when trying to create a shop item with an existing ID or name.

Troubleshooting

The leaderboard or shop embed is not appearing
  • Make sure the configured channel exists and the bot has View Channel, Send Messages, Embed Links, and Manage Messages permissions.
  • Verify that the channel ID is correctly configured.
Shop roles are not being granted
  • Ensure the bot has the Manage Roles permission.
  • Make sure the bot's role is positioned above the roles configured as shop item rewards in the server's role hierarchy.
Admin commands are not available

Admin commands (add, remove, set, destroy) are only available when "allowCheats" is enabled in the module configuration. Enable this setting if you want administrators to manage user balances.

Stored data

The following data is being stored:

For every user:

  • The Discord User ID
  • The current balance and bank amount
  • Metadata about the entry (date when created and last updated)

For every cooldown:

  • The Discord User ID and command name
  • The timestamp of the last command use
  • Metadata about the entry (date when created and last updated)

For every shop item:

  • The item ID, name, price, and associated role
  • Metadata about the entry (date when created and last updated)

For every message drop opt-out:

  • The Discord User ID of users who disabled drop notifications
  • Metadata about the entry (date when created and last updated)

To remove all data stored by this module, purge the module database.