vdeville / twitch-bot

Framework/Library to create Twitch bot using PHP and module system. Easily create your own module with your own features
https://mythevalentinus.github.io/twitch-bot-docs/en/
GNU General Public License v3.0
7 stars 0 forks source link

[PROPOSAL] Properly Parsing all IRC Tags #14

Open mahony0 opened 4 years ago

mahony0 commented 4 years ago

I just looked at Project cardboard. I think before creating an User Class, we need to parse IRC tags properly (yes, all of them at once). After that, we can handle all user-related tags easily in the Class.

I just saw this IRC Parser and it looks good and lightweight to me. Twitch uses IRCv3 and this library is also looks suitable with that version.

vdeville commented 4 years ago

Twitch use more than IRCv3 From flag you send at connection of user. My idea is to crate an User class to begin, and after upgrade this class to add new possibilities.

But at the start of this project i dont want any process in class, but after reflexion, maybe, move some process make for the moment in IrcConnect class to respectivly User/Message/Command class.

If possible, I would prefer to do not use third-party library. My twitch framework is made to be robust and less consumption as possible

mahony0 commented 4 years ago

It's not mandatory to use and depend external libraries, we can adopt them. I think it's logical to parse IRC message and use every single tag in related helper Class with _get methods.

User class is usable only if there are some kind of extra functionalities which depends on user data. For example methods like $message->getUser()->allMessages() or $message->getUser()->banInfo() or $message->getUser()->timeouts() is likely handy if there will be a database which holds all of this information.

Also it needs to be listen 2nd socket connection on Pubsub Endpoint for getting realtime timeout/ban/unban details of current message sender user.

I recommend to start with getting every single data from IRC string, log them for use later and assign them on appropriate Classes.

Or not improve this library too much for not bloating and leave it as is for keeping simple and robust.

vdeville commented 4 years ago

I think they are a middle decision ^ ^ Parse all tag possible Ok, but make this properly to keep performance optimization. This week and week-end i will work on this project and check what is better. But for the moment, i'm sure to do not make any connection with DB to store data history.

mahony0 commented 4 years ago

If you wish, I can send PRs related to some code style and performance optimizations which I made my own library. Most of them are not changing the way of working the bot.