Skip to main content

A Yahoo Fantasy Sports bot for Discord

Project description

harambot-banner

Harambot

An interactive Yahoo Fantasy sports bot for Discord.

Python License Build Version

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

Deploy to Render

Run the bot locally using pip package

  1. Install the harambot package using pip

     pip install harambot
    
  2. 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
    
  3. Run the bot

     harambot
    

Run the bot locally using docker

  1. Pull the latest image from docker hub

     docker pull dmcp89/harambot
    
  2. 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
    
  3. 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

  1. 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

discord-oauth

  1. Navigate to the generated url in a web browser and authorize the bot for your guild

discord-oauth-url-1 discord-oauth-url-2

Configure your guild

  • Once your bot is added to your guild you can configure it by using the /configure command:

discord-config-commnd

  • Use the Login with Yahoo button to authenticate with Yahoo and get your Yahoo token (this is a one time token)

discord-config-yahoo

  • Use the Configure Guild button to configure your guild for the bot

discord-config-guild

  • You can reconfigure your guild by running the configure command and clicking the Configure Guild button.

discord-config-guild

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harambot-0.4.1.tar.gz (6.2 MB view details)

Uploaded Source

Built Distribution

harambot-0.4.1-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file harambot-0.4.1.tar.gz.

File metadata

  • Download URL: harambot-0.4.1.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

Hashes for harambot-0.4.1.tar.gz
Algorithm Hash digest
SHA256 66c81a9f028a8b7226d8e434a4c9986a2d5b815c1a1e51b24f10b081756e6e0b
MD5 716d1dd63ba843ad30c90c04560a0a7c
BLAKE2b-256 c0043de6adee4d60b857c3c5db6d441e7ec54e4be9621d845690d2a98492c4ac

See more details on using hashes here.

File details

Details for the file harambot-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: harambot-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 20.3 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

Hashes for harambot-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b3edb6056d8f376b6b13d77fc082a434cb801f2ec8eb59b0a5ba471e69668e00
MD5 a5cbea29d0e005bf37064d49ac3dd613
BLAKE2b-256 96f458e5b7cd52832a351e71c9cbe87b0e69f5375969d3625ba93d412e314e38

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page