Hi!
First of all: Nice tool, really! Love it.
This is not a bug or feature request or so, but I have a question, because it's not documented.
I have a custom command, where I need to save data into a new table in the mysql bot database. How do I manage that?
Hi @tchibomann 馃憢
Great question!
If you've added your table to the same database the bot is using, the best option would be to extend the DB class and create your own class that does all the database work you want.
Take a look at the ConversationDB and BotanDB classes to see how they extend the DB class.
Then simply require your own DB class in your main bot script (probably hook.php) and you can then make use of it in your commands!
Give that a try and if you need assistance and example code, just ask!
Hi @noplanman!
Thanks for your quick reply! And thanks for the hint with BotanDB! Don't know, why I didn't come up with this idea by myself. Sometimes I'm blind for such obvious things...
I know now how to deal with that, I really begin to like this concept!
Great!
I'll close this issue then.
If any other questions come up, just create a new one.
Happy coding 馃槆
Most helpful comment
Hi @tchibomann 馃憢
Great question!
If you've added your table to the same database the bot is using, the best option would be to extend the
DBclass and create your own class that does all the database work you want.Take a look at the
ConversationDBandBotanDBclasses to see how they extend theDBclass.Then simply
requireyour own DB class in your main bot script (probablyhook.php) and you can then make use of it in your commands!Give that a try and if you need assistance and example code, just ask!