![]() ![]() Their Free plan is pretty robust and will be enough for most servers. They offer 3 different plans that you can avail of. It’s already being used by over 18.1 million users across nearly 27K servers. SomeHelper.gg is a very helpful bot for companies and businesses who manage and run a Discord server. The main feature that Helper.gg provides is the ability to create tickets and give support to users within the community. But through this experience, I felt like I leveled up a bit on my path to become a better is a simple but useful Discord bot that’s perfect for community servers. If there is another solution out there, I would love to dive deep and tinker with it out some more. I hope this was an educational post for those needing it. Once it clicks, it’ll be like any tool in the box. It’s a great way to format your Redux stores. When creating your own redux store for your applications, try to follow the Redux Style Guide. I was able to find the confidence and ability to think critically about my code and swiftly seek solutions when there were problems. ![]() It wasn’t long ago that I didn’t know how to code properly but thankfully with the help of Code Chrysalis and their immersive coding boot camp. Also special thanks to the Reactiflux community on Discord, specifically phryneas#4779 and acemarke#9340 directing me towards the right direction when building the Redux store. I want to give many thanks to the teams that maintain Discord.js and Redux ToolKit. If you’ve arrived at this point, I hope I was able to impart some knowledge or reaffirm something you’ve been thinking about. guildInfo is the data I received and am passing through to the reducer.įrom there, for any command that occurs within our bot, we can check the store using our guildsSelector.guildAdded is a reducer I’ve created back in guildsSlice.js.store.dispatch is a method on the store that says “hey, we want to run an action.”.store is the global state where we’re holding everything.It’s nothing special but the way I handled my database - it’s not the primary key there. Note: My serverCache function is returning an object that includes the Discord Server ID as _id. Store.dispatch(guildAdded(serverCache(guildInfo))) Simple right? But here’s the important line for our store at this point: If the bot sees that the server exists on the database already, it caches the information from MongoDB to the local store for later use.If it has, new guild information is added to the database and the local store.Jeetbot checks with Discord to see if Jeetbot has been added to new servers.Here’s the fun part with Discord.js and Redux.js.īasically, this code is doing the following: Module.exports all that and we’re ready to start using Redux Toolkit within the index.js of JeetBot. It’s good to have them on to check if you’re adhering to the Redux methodology though! GuildsSlice.js → store.js → index.js is the flow.įor developmental purposes, immutableCheck, serializableCheck, and devTools are good to have on (you don’t have to write false in there as they default to true if you leave out getDefaultMiddleware() and devTools.) Since they take time for every action that is dispatched, I turn it off so my programs can run faster. We’re exporting the reducers from guildsSlice.js here to be recognized within the store when the store is initialized in Index.js. I have a command handler that takes in splits up the message coming from a Discord user and recognizes it as a command: client.on("message", async (msg) => ) Let me describe below what I had encountered in my process trying this out. ![]() I thought I needed to set up a hash map data structure when the bot initializes and makes changes to the local cache when database changes occur. This means that users are actively mutating/changing certain options and this is happening asynchronously with the rest of the other Discord servers the bot was on. ![]() One of the things that the bot has to keep an eye on are user inputs that change the database. But transferring data back and forth on the internet costs money at times, and I wanted to scale this bot properly, so I needed to save some of the data locally, within the bot. In a happy, land-of-the-free type of internet, all the reads/writes would cost me nothing. In my journey to creating a useful Discord bot for discord users and myself, there came a point where I was retrieving data from my MongoDB database too many times. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |