So, as it was said in the title, I was too lazy to study discordgo for developing a bot on go. Why? Well.. I just sat down to study go and didn't have a clear idea of what and how, so I decided not to go into the library from 15 years ago, which clearly has a lot of legacy code.
The link: https://github.com/IIIoooRRR/G4D
Instead, I decided to write my own project for small bots. However, I didn't know exactly how to do this. I started studying the in-depth documentation of discord - oops! The structure of the network core was gradually drawn by itself.
Everything was originally based on parsing through map[string]struct{}, at that time I didn't even know about the existence of the basic encoder, sonic, zap, and the like
Then I accidentally deleted (after about half a month, a month) all the commits of the repository. The token turned out to be a problem there, which resulted in the network, and that's how it turned out.
Over time, I began to understand: I like the development of this library, I can't do without it, periodically I come back to it in bursts, I try something and forget again for a week or two.
What have I been able to do in these 4 months?
Here is a short list:
- Lock free structure. There are almost never mutexes. I tried to change everything to atomics and work with them. Soon I wanted to rewrite the api package for rw mutexes, since it went to fanaticism and one uncritical problem appeared.
- DI structure. Literally, today's commit solved my previous problem - I did everything through singletons (I tried to do it), and now I'm transferring everything, if not already, to the di architecture.
- cli and yaml are supported in the library. There are several yaml examples in the repository itself, while the cli is still used to initialize the project. It builds the project structure that I used to work with my bot.
- Partial modularity. It's easy to rewrite everything except the network core and the basic structure of the bot. I tried to divide the project itself into atomic particles. I'm sorry, I'm a former Javist.
- Clear typing. I tried to make sure that the fields could not be confused when interacting with the fields of the discord api.
In general, that's all I could tell you about the library. I tried to save and do everything without the divine structures, I like easy and convenient work with libraries, but I'm bad at writing documentation. The main examples are described in the readme, and I also tried to document the code as I wrote the project.
Top comments (0)