A Yahoo Fantasy Sports bot for Discord
Project description
Harambot
An interactive Yahoo Fantasy sports bot for Discord.
Commands
/ping - Gives the latency of harambot
/RIP - Pay respects
/standings - Returns the current standings of the current league
/roster Team - Returns the roster of the given team
/stats Player - Returns the details of the given player
/trade - Create a poll for latest trade for league approval
/matchups week - Returns the matchups for the given week, defaults to the current week
/waiver days - Returns the waiver wire transactions from the previous number of days
/configure - Configure the bot for your guild
/reports - Set what channel transaction reports should be sent to.
You can find example output of these commands here
Roll your own instance
Prerequisites
In order to properly configure your bot you will need the following:
Visit our wiki for a step by step guide on how to obtain these values.
Generate a key for your local database
Parts of the database are encrypted, which means we need to generate a key. Using the python interactive interpreter, you can generate one by running these three lines inside the interpreter:
from cryptography.fernet import Fernet
fernet_key = Fernet.generate_key()
print(fernet_key.decode())
Your key will appear below.
Run the bot on Render
Run the bot locally using pip package
-
Install the harambot package using pip
pip install harambot
-
Export the following environment variables
export DISCORD_TOKEN='[YOUR DISCORD TOKEN]' export YAHOO_KEY='[YOUR YAHOO API CLIENT ID]' export YAHOO_SECRET='[YOUR YAHOO API CLIENT SECRET]' export DATABASE_URL='[YOUR DATABASE URL]' # which can be a pathway to a file, such as 'sqllite:///harambot.db' export HARAMBOT_KEY='[YOUR ENCRYPTION KEY]' # A URL-safe base64-encoded 32-byte key
-
Run the bot
harambot
Run the bot locally using docker
-
Pull the latest image from docker hub
docker pull dmcp89/harambot
-
Export the following environment variables
export DISCORD_TOKEN='[YOUR DISCORD TOKEN]' export YAHOO_KEY='[YOUR YAHOO API CLIENT ID]' export YAHOO_SECRET='[YOUR YAHOO API CLIENT SECRET]' export DATABASE_URL='[YOUR DATABASE URL]' export HARAMBOT_KEY='[YOUR ENCRYPTION KEY]' # A URL-safe base64-encoded 32-byte key
-
Run the bot
docker run --name harambot \ -e DISCORD_TOKEN=$DISCORD_TOKEN \ -e YAHOO_KEY=$YAHOO_KEY \ -e YAHOO_SECRET=$YAHOO_SECRET \ -e DATABASE_URL=$DATABASE_URL \ -e HARAMBOT_KEY=$HARAMBOT_KEY \ --rm dmcp89/harambot
Setup
Add the bot to your guild
- Generate a OAuth url from the discord developer portal using the bot scope and the following permissions:
- Send Messages
- Send Messages in Threads
- Embed Links
- Attach Files
- Read Message History
- Add Reactions
- Use Slash Commands
- Manage WebHooks
The permission value should be 277562378304
- Navigate to the generated url in a web browser and authorize the bot for your guild
Configure your guild
- Once your bot is added to your guild you can configure it by using the /configure command:
- Use the Login with Yahoo button to authenticate with Yahoo and get your Yahoo token (this is a one time token)
- Use the Configure Guild button to configure your guild for the bot
- You can reconfigure your guild by running the configure command and clicking the Configure Guild button.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file harambot-0.4.1.post1.tar.gz
.
File metadata
- Download URL: harambot-0.4.1.post1.tar.gz
- Upload date:
- Size: 6.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.7 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7fbe45e9ff9be07aca552ce48617e0cfb1ca1bf455139af0977a06bf6ffc7733 |
|
MD5 | 1c14f732e0095e8e04082d3ef718d20f |
|
BLAKE2b-256 | f6cf44661564f319c95a06db14ceb7b7b2a2afa4457539b7745ef9b8a70e091a |
File details
Details for the file harambot-0.4.1.post1-py3-none-any.whl
.
File metadata
- Download URL: harambot-0.4.1.post1-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.10.7 Linux/5.15.153.1-microsoft-standard-WSL2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65891837b43f80cdc962bb60c4af4da0636b89f731a696beea1d9d9491101230 |
|
MD5 | 1e94f8a5be206df36f30555477a8c266 |
|
BLAKE2b-256 | 626e9c8222652df7c0b48b4b93e594f0a8e63c3507d19caebf06e435f3a751cd |