-
Notifications
You must be signed in to change notification settings - Fork 93
Shop Red V3
@ WIP
This cog was created exclusively for the Red-DiscordBot project. For installation instructions go to my main github repository for more information.
- A menu can now be used to buy items, check your inventory, and review the pending list.
- Direct purchasing is available if you know your shop and order.
- Multiple shops can be added with their own item lists.
- A role can be assigned to a shop to restrict access.
- Items now have one of 4 types: basic, random, role, and auto.
- Random items can be added to a shop to give a random item weighted on cost.
- Removed manual and automatic modes. This is handled through item types now.
- Removed the buyrole cog dependency from Refactored Cogs.
- Multiple items of the same name can be pending from the same user.
- Added a restock command to restock all items in a particular shop by a set amount.
- Added a bulkadd command to add multiple items to multiple shops via text or csv.
- Users are now sent an alert when their item is cleared from the pending list.
- The alert role is now mentioned instead of whispering everyone with that role.
- Auto items cannot be infinite.
Special
The inventory command does not require a shop
or setshop
prefix.
Name | Command | Description |
---|---|---|
Inventory | [p]inventory |
Displays your purchased items. |
Shop Commands
Name | Command | Description |
---|---|---|
Bulk Add | [p]shop bulkadd <style> <entry> |
Adds multiple items and shops. |
Buy | [p]shop buy [purchase...] |
Shop menu appears with no purchase order. |
Clear Inventory | [p]shop clearinv <user> |
Completely clears a user's inventory. |
Give | [p]shop give <user> <quantity> [shopitem...] |
Gives a user an item. |
Gift | [p]shop gift <user> <quantity> <item> |
The item must be in your inventory and have enough to cover the quantity. |
Item | [p]shop item <action> |
Creates, Deletes, and Edits items. |
Manager | [p]shop manager <action> |
Creates edits, or deletes a shop. |
Pending | [p]shop pending |
Displays the pending menu. |
Redeem | [p]shop redeem <item> |
Redeems an item in your inventory. |
Restock | [p]shop restock <amount> <shop_name> |
Restocks all items in a shop by a specified amount. |
Trade | [p]shop trade <user> <quantity> <item> |
Attempts to trade an item with another user. |
Trade Toggle | [p]shop tradetoggle |
Disables or enables trading with you. |
Version | [p]shop version |
Shows the current Shop version. |
Wipe | [p]shop wipe |
Wipes all shop cog data. |
Set Shop Commands
Name | Command | Description |
---|---|---|
Alert Role | [p]setshop alertrole <role> |
Sets the role that will receive alerts. |
Alerts | [p]setshop alerts |
Toggles alerts when users redeem items. |
Gifting | [p]setshop gifting |
Toggles if users can gift items. |
Mode | [p]setshop mode |
Toggles Shop between global and local modes. |
Sorting | [p]setshop sorting <style> |
Set how shop items are sorted. |
Toggle | [p]setshop toggle |
Closes/opens all shops. |
There are currently four item types in shop. Each have unique properties and use cases.
Basic items are just normal items. A user purchases it, and it's added to their inventory. They can redeem it at anytime via their inventory or the redeem command. The idea, is that you already have something of value, either in real life or in a game that you will give to the user after they redeem the item and you have a chance to review it. Please check out my FAQ for more information on using shop.
Role items serve as tokens for an actual role on the server. The role must already exist on the server, and the role given must be lower than the bot's role. Once the user redeem's the item, it will grant them the role. They can also trade it to another user.
Random items gives the person who purchased it, a random item from that particular shop, not including random and auto items, based on value. Lower priced items will be more common, and higher price items will be more rare. I recommend only adding this kind of item to a shop that has several items. You cannot select the range of items this will give.
Example: Let's say a shop has four items with the following prices:
Torch 5gp
Mystery Box 25gp
Potion 40gp
Holy Water 100gp
If a user buys the mysterious box, they are most likely to get a torch, while a potion is uncommon, and a holy water being rare.
Note: If a random item is the only item left in a shop, the shop will not be displayed, until a basic, role, or auto item is added.
Automatic items send the user a private message when purchased. You must have a list of messages created for this item. It is recommended that you use a csv file with the Bulk Add command for auto items. The quantity is tied to the number of messages. Auto items cannot be infinite.
Command
[p]shop buy [purchase]
Description
Allows the user to purchase an item from the shop. If the purchase argument is empty then the shop menu will be displayed. If you do not wish to use the menu, and want to purchase an item directly, please refer to the examples below. You can only purchase 1 random item at a time.
Direct Purchase Examples:
[p]shop buy "Secret Shop" oil
[p]shop buy Junkyard tire
[p]shop buy "Holy Temple" "Healing Potion"
Command
[p]inventory
Description
Displays a menu of all of your items. Upon selecting an item, you will be prompted to weather or not you wish to redeem that item. For redeem items more quickly when you know the name, please refer to the redeem command.
Command
[p]shop redeem <item>
Description
Redeems an item in your inventory. This command is a shortcut from selecting an item using the inventory menu. You can redeem multiple items. When your item has been removed from the pending list, you will be sent an alert from the bot.
*Only basic type items can be redeemed. A role item will automatically grant the user a role, assuming it is available on the server.
Command
[p]shop trade <user> <quantity> <item>
Description
You can trade items with other users using this command. The target user must be on the same server the command was issued, regardless if the shop is global or not. This command does come with a 60 second cooldown to prevent users from tormenting each other. Each user can also has the option block all trades (see Trade Toggle).
Command
[p]shop bulkadd <style> <entry>
Description
This command helps bypass the item creation process by adding multiple items to multiple shops without having to answer several prompts. You can use two styles: text or file.
Text If you use text as your style, you can insert a multi-line input (up to 2k characters). You cannot add auto items using the text style updater. This is because auto items require a list of messages, and this format is not conducive to those restraints. For example, the following is a valid bulk update:
[p]shop bulkadd text
Holy Temple, Torch, basic, 20, 5, Provides some light.
Holy Temple, Divine Training, role, 20, 500, Gives Priest role., Priest
Junkyard, Mystery Box, random, 20, 500, Random piece of junk.
File The file style will allow you to bulkadd items and shops via a csv file. You can add auto items using this method. Make sure that the file type is a csv, and that it is located in the bundled data folder. Look at the example file that comes with shop for more details. The following is a valid entry using files:
[p]shop bulkadd file Example.csv
For any entry that is invalid, an error message as to why it was not added will be displayed in the console and logged. I am working on creating a better system for this, but for now, check your logs or console.
Command
[p]shop gift <user> <quantity> <item>
Description
This will let you giveaway a number of your items to another user. This command is different from the Give command, which will administratively give an item to a user from a shop. Gifting is turned on by default, but you can optionally turn it off via [p]setshop gifting
. The idea here, is that if you certain shops, which require certain roles, some users could circumvent these role restrictions by having a user with that role purchase the item for them. If your shops do not depend on any sort of role hierarchy, I recommend keeping this feature on.
Example
[p]shop gift Redjumpman 3 Healing Potion
Command
[p]shop give <user> <quantity> [shopitem...]
Description This will allow an admin to give a user an item from the shop. The item must be in the shop in order for this item to be given. Only basic and role items can be given. Giving a user an item does not affect the stock in the shop. If the shop name or the item name is more than one word, you must use double quotes (") to capture all of it.
Examples
[p]shop give Redjumpman 1 "Holy Temple" "Healing Potion"
[p]shop give Redjumpman 1 Junkyard Scrap
Command
[p]shop restock <amount> <shop_name>
Description
This will restock every item in a specific shop, based on the amount you specify. The only items this command will not restock is auto items, because they require a message for each one added. It's possible I'll expand this to work for specific items in a shop at a later date.
Command
[p]shop
Description
Command
[p]shop
Description
Command
[p]shop
Description
Command
[p]shop tradetoggle
Description
Blocks other users from trying to trade with you. If a user tries to trade with someone who is blocked, they will still have the trading cooldown triggered.
Command
[p]shop clearinv <user>
Description
This will wipe a users inventory. You will not be able to recover any data after this command is used!
Command
[p]shop version
Description
Displays the currently installed version of shop.
Command
[p]shop wipe
Description
This will wipe all of shops data, including user inventories. Basically, this will revert shop back to it's factory settings.
Command
[p]setshop alertrole <role>
Description
The role that is mentioned whenever a user redeems an item. If the shop is set to global, then only the owner
will be notified via DM. To turn off alerts, refer to the alerts command.
Command
[p]setshop alerts
Description
Toggles alerts on/off. When alerts are on, and a role is set, that role will be pinged each time a user redeems an item. If the shop is set to global, then only the bot owner will be sent an alert.
Command
[p]setshop mode
Description Changes the shop between local and global modes. Changing modes will result in a complete wipe of all of shop's data. While in global mode all admin level commands can only be used by the bot owner or co owners. In local mode, admin level commands are delegated on a per server basis.
Command
[p]setshop sorting <style>
Description This will change how all shops will have their items sorted. You can choose one of the following options:
- Price - The shops will sort from highest to lowest priced items (Default Setting)
- Quantity - The shops will sort from highest to lowest based on quantity
- Name - The shops will sort items alphabetically.
Command
[p]setshop toggle
Description This will close all shops and prevent users from being able to purchase any items, or it will open all shops to allow purchasing again.
What are the items for?
What ever you want. Collecting rare items on your server, for use in a game you own (name changes, sex changes, etc), granting roles, sending codes, whatever you want.
I still don't get it... how is this cog useful for me?
Look dude. Maybe this cog isn't for you. If you are struggling on how to use this cog, then just uninstall it and quit bothering me about how you don't know what to use it for. This is a niche cog, not a general purpose cog.
Am I limited to only four item types?
Yes...for now. I designed it so I could easily extend this to add more types with new functionality. I'm flirting with the idea of having audio items, recipe items, command items. We will have to see when I have more time what will happen. If you have a suggestion, then let me know by making an issue.
Why is my item info truncated?
I can only fit so much space into the embed. I'm also trying to be a little more mobile friendly, and the restrictions I have on info, item names, etc, help with allowing more users see all the information correctly.
Why can't my users redeem the role item they bought?
You can only redeem a role item if the role exists on that server. Otherwise, it will not allow you to use it. I have no intention of allowing this system to create roles on the fly, so if you make a role item, make sure that role is available on that server.
Why can't I just have an unlimited auto item and feed messages as needed?
Having the quantity tied to the messages is the best way to handle an empty message queue. Otherwise, I'm forced to do some additional handling when you are too lazy to add the messages required. I may, in the future add a type that sends the same message and can have infinite quantity.
Will shop support other currencies, like cookies from your cookie cog?
Yes! I am working on allowing other currencies, but it will come at a later date.
While this wiki contains a lot of information, some of it may be incomplete. If the information contained here still does not answer your question, feel free to pop over to my support channel on Red - Cog Support Server.