Replies: 2 comments 2 replies
|
It really depends on how you want to implement this. When I say "it depends", it's all about the needs of your app. If you need a robust way to store data, then you have to go with a database implementation (e.g. MySQL), but if you just want to store plaintext data and then parse it (in your case, links/URLs), a .json file (or even a .txt file as you mentioned) will be enough. My suggestion is, instead of using a text file (to avoid formatting and parsing problems) you should use a JSON file to store your links. You can then easily read the file when you want to randomly select a link. There are many examples, both in StackOverflow and the discord.py Discord server (and on the internet in general). |
|
You don't need the Spotify API just to store submitted links and randomly choose one. For a small bot, you can append each submission to a text file: import random @bot.command() Then randomly draw one: @bot.command() For a friend-group bot this is enough. If you later need to prevent duplicate submissions, track who submitted each album, or remove entries after drawing, SQLite would be a better next step than a text file. |
Uh oh!
There was an error while loading. Please reload this page.
so i'm currently making a discord bot which helps out with an album exchange which my friend group uses.
and so basically, i can't find anything that can help out with being able to submit spotify/album links to the bot, so it puts it into a txt file, then when i draw the submitted albums, it randomly auto-selects one.
can anyone help out or point me into the right direction?
All reactions