The One and the Many

MySQL quote script for Eggdrop

While using MySQL for a quote script is generally overkill, it can be useful. Up until a couple days ago I had been using a script which saved and read quotes from a text file. It's been working that way fine for years. However, I also have a website that uses a MySQL database to display quotes. Generally I would sync it occasionally. But this is quite cumbersome to do. As well, the quote script I was using was quite a big hack and a hugely edited version of another quote script, so I wanted to replace it regardless, but never worked up the motivation to do so.

Reading and some minor writing to the database takes a lot of work out of the script. And now my quotes are synchronised on both the website and the bot.

This could be done with sqlite to avoid having to run a MySQL daemon just as easily, but as I already run a database server...

One good feature of the way that the quotes work is that multiple line quotes are allowed. Any newline characters signify a new line. Quotes are displayed as follows:

[bot] Quote #123
[bot]  [user] hi there
[bot]  [user2] hey

The database schema is included in the comment header in the script.

Unfortunately, the website code is not available at this time, but the script is still very usable on its own.

The script can be found here: sqlquote.tcl.

Note: The script requires mysqltcl.

Tags: eggdrop, irc, tcl

Back

Comment