Package: sciolyid
SciOly-ID-Discord-BotsA template for creating Discord Bots to study for Science Olympiad ID events.UsageNote: Some steps in this tutorial assume a Linux/Mac environment.To setup your own bot, follow these steps:Create a new folder and install SciOly-ID.SciOly-ID can be installed with pip:pip install -U sciolyidOr you can install the latest version of the code from git:pip install -U git+git://github.com/tctree333/SciOly-ID.gitSetup your bot by callingsciolyid.setupand passing in your config options as arguments:importsciolyidsciolyid.setup(...)For examples of configs, see theexamples section. For a full list of config options, see thesource code.Create a new file calledsetup.sh:#!/bin/shexporttoken=This will be used to store environment variables. We will fill these in later.Put this in.gitignoreif you have a public github repo.Now we need to add the lists. Create a new directory(pass this in to the setup function asdata_dir) and create a new file called whatever you're IDing. For example, a fossils bot would have a list calledfossils.txt. If you have categories, create a file for each category. Fill in these files with the lists, one per line.If some items in the list can go by a different name, you can create a new file calledaliases.txt. Input your aliases one per line, with the name in the other list as the first item.Now, input the links to the wikipedia pages for each item in a new file calledwikipedia.txt. You can manually enter them in, making sure the name matches the items in the other list. You can also runpython -m sciolyid.scripts.generate_wikia few times to generate the list for you. You will still have to manually go through to ensure the correct link was found.Register a bot account on theDiscord Developers Portal. To do so, create a new application. Name your application, then navigate to theBotsection, and add a bot. Change your application name if necessary. Updatesetup.shwith your bot token (Botsection), and Discord user id. You can also generate your bot invite link. Go to theOAuth2section and checkbotin theScopessection. In theBot Permissionssecion, checkSend Messages,Embed Links, andAttach Files. Copy the URL generated and update your config options.Great! Now we will need to add images. Create a new GitHub repository to host your imageshere.This next step will be the most difficult to do online, though it is possible. See theAdding Picturessection below for more info.You will need to upload at least one picture of each item on the list, but more is definitely reccomended. These will be the pictures you see when using the bot, so more variety and more pictures is better. Get some friends to help out. The repository structure should becategory_name/item_name/image_name. Images should be smaller than 8MB and in a.png,.jpg, or.jpegformat. You can see examples in theexample section. To quickly create the directory structure, runpython -m sciolyid.scripts.generate_file_structure.Once you have all of this set up, it's now time to run your bot.Install a local Redis server by runninginstall-redis.sh. Start your Redis server withpython -m sciolyid.scripts.install_redis.SourceYou are now ready to run the application! Setup the environment withsource setup.sh. Start the bot by calling the python file.Congrats! You just created your own ID Discord bot.Add your bot to the Discord server of your choice using the invite link generated in step 6.If there are any issues or you have any questions, let us know in the SciOlyIDDiscord support server.It may also be helpful to use an existing bot as a template. See the examples section below.ExamplesReach for the Stars ID Bot- [https://github.com/tctree333/Reach-For-The-Stars-Bot]Reach for the Stars ID Bot Images- [https://github.com/tctree333/Reach-For-The-Stars-Images]Fossils ID Bot- [https://github.com/tctree333/Fossil-ID]Fossils ID Images- [https://github.com/tctree333/Fossil-Bot-Images]Minerobo Bot- [https://github.com/tctree333/Minerobo]Treebo Bot- [https://github.com/tctree333/Treebo]Bird-ID- [https://github.com/tctree333/Bird-ID] (doesn't use this template, more advanced)HostingThere are many options for hosting a bot, you can run it on your own computer, run it on a Raspberry Pi, or find cloud hosting options. This repo is setup to use Heroku or Dokku, but there are drawbacks as Heroku is fairly underpowered and will restart your bot once a day. If you are planning to use Heroku, you may want to use their cloud Redis databases.Adding PicturesIf you're new to Git and GitHub, an easy way to get started is with GitHub Desktop.Create a GitHub account if you haven't already.Install GitHub Desktophere. Open it.Log in with your GitHub account. Follow the tutorialhereto clone and fork this repository. When you get to step 2, use"URL"instad ofGitHub.comwith the urlhttps://github.com/tctree333/Fossil-Bot-Images.git. Note the generatedLocal Path. Continue as normal.In your file explorer on your computer, navigate to the generated path. Now you are ready to add images! Drag and drop downloaded images to the appropriate folder, ensuring that images meet the requirements above and deleting"image.placeholder"if the folder is not empty. However, if the folder doesnothave images,do not delete"image.placeholder".Once you are done adding as many pictures as you want, go back to GitHub Desktop and click"create a fork"in the bottom left corner. Fork the repository, and hit"Commit to master"in the bottom left corner. Then, hit"Push Origin".Finally, hit"View on GitHub"and click"Pull Request"near the middle right. Click"Create Pull Request", give it a name and description if you want, and then"Create Pull Request".Congrats! You just helped add images to the bot! Give me a few days to approve your pull request, and the bot will be using your new images. You don't have to stop here, though. Add more pictures by repeating steps 4-6, though you may have to click"Fetch Origin"occasionally to make sure your copy is up to date.Thanks for helping out!ContributingRun the following commands to install a development version:gitclonehttps://github.com/tctree333/SciOly-ID.gitcdSciOly-ID
pipinstall-U.