Open tupperward opened 2 years ago
@9gl This might be a good starter one for you. I tried to write it out as quickly as I could.
To be honest, of the three things I want to add to sqlite this one is likely the hardest. If you want to try doing this with bovonto.py
or bobross.py
that would probably be easier and would generally follow the same steps. The only big difference is the logic at the end, though, in tarot
it's just a little more complex.
Yeah, sure, I'll give it a shot.
@9gl I just did some work to move all the stuff from the bovonto
and bobRoss
modules over to Sqlite3. There's a new script in the repo called db_migrate.py
that I used to do it. That might be helpful for you in this task as well.
Use sqlalchemy to create a new table
tarotData
with the columnsid
,image
,keywords
,meaning
,reading
,title
,url
andyesno
.Write a for loop to load the data into the table using a standard
INSERT
statement. This can be done in a sqlalchemy Session using the execute method. You will need to make sure this loop includes a counter to set theid
value.Once the data is loaded, it should be fairly easy to modify the logic to select a random number between range of 1 to, SELECT that
id
and return the values from that row into the discord Embed.https://github.com/tupperward/WATTBA-Butterbean/blob/b2e5a855324ae2ed75a964aef598884d3053db4b/app/modules/tarot_data.py#L1-L2754
https://github.com/tupperward/WATTBA-Butterbean/blob/f2e4ee6429310e5aa47724664e4a5b74b98a4866/app/butterbean.py#L239-L254