rawsonj / triviabot

A simple IRC trivia bot written in python using twisted.
GNU General Public License v3.0
41 stars 51 forks source link

using a database for questions and answers #53

Closed andy5995 closed 6 years ago

andy5995 commented 8 years ago

I'm not sure how much this would help, and don't necessarily think it's the best idea, but wanted to open up a discussion about it.

Would using a database make it easier to edit, organize, and manage the questions?

If a database were used, should it only be used for organization and editing, but then exported back to text files? (thereby avoiding having to add database support to trivia.py)

rawsonj commented 8 years ago

I think using an sqlite database file with trivia would be ok. I'm not totally sure what you would gain by using it though, and database backends tend to be less approachable than flat files by people.

I'm not sure what we would gain by doing this though.

andy5995 commented 8 years ago

Hmmm... since we're both unsure if the benefits would be worth it, I'd suggest we put the idea aside for now, but keep the ticket open.

I tend to think a random access database is more efficient and faster than getting info from a group of extremely large text files, but I haven't played around with TB yet enough to say I'm strongly in favor of a speed increase.

Also you mentioned in #50 the possibility of switching to a generator. I wouldn't feel comfortable working on that yet; I'd rather stick to helping with tedious or trivial tasks that you can think of before I go to something that sounds more advanced, such as a generator.

Aside from the other things I mentioned above, the questions would be automatically numbered using the database records, giving users a flexible way to report questions.

But we've discussed some of that in #53 I think, and on IRC, and sounds like you'd be satisfied for now with a reliable way to ?report previous. I can still work on that some more. I haven't put much effort into getting creative about solving that yet because this week has been weird for me. :) But I'm still up to seeing what I can do with it.

But do you think I should still wait to work on ?report until the generator idea is decided upon?

rawsonj commented 8 years ago

One doesn't really have much to do with the other. We could change our question-fetching mechanism to use a generator and not impact ?report much, if at all.

The generator could return file and line number, along with the question and answer object.

Alternatively, it could just update a variable that holds on to file and line number information so that it could be reported.

rawsonj commented 6 years ago

So I've been doing a lot of database admining and development at work and have determined databases are an invention by The Devil.

Not a good fit for triviabot.