-
Notifications
You must be signed in to change notification settings - Fork 1
Home
If you want install the bot (whether it's for personal use or contributing), follow these instructions. Contributors should read the last snippets of instructions for important information.
Here, we will: create the necessary accounts to generate the bot token, copy and paste it on your PC and run the bot. Note: this bot is a private bot. While inviting a private bot in any given server technically works, it will remain offline and functionless until something runs it with a unique bot password (referred to as a token).
- A Discord account | https://discordapp.com/
- A Disord server | https://support.discordapp.com/hc/en-us/articles/204849977-How-do-I-create-a-server- | You can create your own or use someone else's.
- A Discord Developer account | https://discordapp.com/login?redirect_to=%2Fdevelopers | Here, you'll generate the bot profile and bot token.
- PyCharm | https://www.jetbrains.com/pycharm/download/#section=windows | For now, you will host the bot locally on your own machine. If you know what you're doing, any other IDE or hosting service will work.
-
Go to your Discord Developer account. Create a new bot by clicking
New Application
. -
Give it any name. Click
Create
. You should now see some general information pertaining to the bot. -
On the left-hand side, click
OAuth2
. -
Under
Scopes
, check off theBot
check box. -
Under bot permissions, tick
Administrator
(should be in theScopes
section). -
Copy and paste the generated link into your web browser.
-
Under
Add a bot to a server
, select the server that you created. Someone else's server can work, too.
However, if you don't see the server listed, here is why: Only server owners and server members with 'Administrator permissions' can invite bots to servers. You are not the server owner and you don't have admin permissions. In that case you must:
- Send the invite link to the server owner or someone with admin permissions.
- Ask the server owner, an admininistor or moderator to give you admin permissions.
- Create your own server if the above isn't a feasible option.
- Click 'Authorize'
You should see the bot listed on the right-hand side. It should be offline. The next step is to run it.
- Open PyCharm
- Clone the repository into the current project
- Edit Configuration -> Script Path -> Select
bot.py
- Python 3.6 - 3.8 is recommended
- Install discord.py package (using pip or project settings). It may be best to install the discord.py version listed in
requirements.txt
. - Go to your Discord developer account and create the bot.
- Copy the bot token.
- At the very bottom of the
bot.py
module, paste the token so it looks like this:
client.run("1234567890aBuNcHoFrAnDoMlEtTeRsToO")
- Run the bot
The bot should now be online and running in the server. You may execute !help
for further instructions.
However, I strongly recommend completing the following server checklist before executing the more extensive functionality. In the probable case that not every use case was handled for new servers, it may not be clear why the bot could be throwing an exception.
Have the following channels created in your server:
-
#landing
- used for the authentication panel, that can be sent out by entering!auth
-
#bot-commands
- is exclusive to some commands, and may be used for updates or error feedback -
#game-lab-availability
- is used for live/dynamic gaming lab PC usage updates -
#help-directory
- used for the visual contact information cards used as embeds -
#game-selection
- download the necessary emojis under releases to use this -
#event-subscriptions
- used for temporary and/or permanent events- this feature is subject to deprecation
Download the custom emojis used by the server here and upload them to your server with the following names:
RocketLeague
FIFA
Hearthstone
LeagueofLegends
SmashBrothersUltimate
Minecraft
TeamfightTactics
Runeterra
ApexLegends
Overwatch
Valorant
CSGO
Fortnite
Exact case is required
Optional- the following game channels are used for the @Game Manager
contact info panels:
#overwatch
#valorant
#hearthstone
#league-of-legends
#fifa
#rocket-league
#fortnite
#smash-brothers-ultimate
These are case sensitive. Characters must be exact.
Create the following roles, any color of your choice:
- 'Auth-ed` - name it as exactly written. The authentication panel gives out this role to people who react to its checkmark.
-
Game Manager
- used for the individual game channels as mentioned above -
Tuesday Gamenight
- at the time of writing this, currently the only supported event FIFA
Hearthstone
Fortnite
Overwatch
Rocket League
Valorant
Smash Brothers Ultimate
League of Legends
Apex Legends
CS:GO
Minecraft
You may notice that some of these roles are also missing game channels. This is because only a handful of games are supported by Stockton in an official capacity. Thus, not every game will have a game manager.
Regarding the topic of using API tokens, you have 3 options:
- Disregard or comment out the functionality that's responsible for processing API data
- Create your own developer accounts and use your own generated API tokens
- Reach out to me for access to the API tokens
The bot should work okay without API tokens. In the case that something doesn't work as intended, I would recommend adding the following environment variables as instructed in the next section.
Have your environment variables for the following. Whether you input completely arbitrary or valid data is your decision.
PyCharm environment variable setup instructions here.
-
TOKEN
- your bot's token
-
GOOGLE_CHROME_BIN
-/app/.apt/usr/bin/google-chrome-stable
- used for web scraping -
CHROME_EXE_PATH
-/app/.chromedriver/bin/chromedriver
- used for web scraping -
DROPBOX-API-TOKEN
- this is the sensitive JSON file used to access the Google Sheets API. If you create your own Google Developer account, you can just put the JSON file in your root directory. -
DROPBOX-PATH-CREDS
- I put the path to my JSON credentials in the root of dropbox folder, as such:/credentials.json
Note: If you choose not to work on the Twitter feed, you can enter completely arbitrary numbers for the following:
-
ID-TWITTER-STOCKTON-ESPORTS
- you can obtain any Twitter user ID from this website -
TWITTER-API-KEY
- submit an application for access to the Twitter API here -
TWITTER-API-KEY-SECRET
- Submitting an application is super easy- just know your rate limits -
TWITTER-ACCESS-TOKEN
- and be transparent about your intentions. -
TWITTER-ACCESS-TOKEN-SECRET
- Just an additional set of access tokens.
Type !help
for a list of available commands.
This bot queries customizable information used in a Google Sheets document. For access to this document, please contact me or browse the Discord server's #help-directory for more information.
Granted, you can completely omit the use of a config file and hard code your data. But if you'd like to reference my current setup, you're more than welcome to contact me and take a look.
To emphasize: I would recommend using environment variables for your bot's protection. Should your bot token be exposed in plain-text, attackers can maliciously alter your bot. You will want to use Python's os
library to safely encrypt your token. Refer to bot.py
for the syntax.
For changes that you make, please commit your changes in a separate branch. When you are finished with your code and have fully tested every test case, create a pull request
to merge it with the master branch. Since Heroku runs off of the master branch, any final changes you made will be reviewed by me or potentially any future admins.
Lastly, please remember to git ignore
your .idea and venv folder. In short, having them can expose the bot token. This is an essential requirement for your changes to be accepted.
I'm available for contact, so please let me know if you have any questions.