Baseball Discord bot that can post up-to-date scores, lineups, and home runs.

Overview

Sunny Day Discord Bot

Baseball Discord bot that can post up-to-date scores, lineups, and home runs. Uses webscraping techniques to scrape baseball data from various websites in real time to respond to commands.

Overview

This bot has three primary functionalities: retrieving scores, lineups, and home runs.

Scores

To retrieve all scores for the current day, use the command >scores. This will post an image for each matchup today. Scores Example

To retrieve the score for a single team for the current day, use the command >score {team's 3-letter abbreviation}. This will post a single image of that team's matchup, if they have a matchup for today.

Lineups

To retrieve all lineups for the current day, use the command >lineups. This will post an image for each matchup's lineups today. Lineups Example

To retrieve the lineup for a single team for the current day, use the command >lineup {team's 3-letter abbreviation}. This will post a single image of that team's lineup, if they have a game for today. Lineup Example

Home Runs

Between 11am and midnight CT, every 15 minutes this bot will scrape the five most recent home runs, compare these against previous home runs, and post new home runs that have occurred. Home Run Example

Setup

Several steps should be taken prior to activating this bot to ensure your system will be able to run it without error.

OS Compatibility

This bot was designed to work on a Linux server and therefore has some features that are only compatible with Linux. With several changes (removing the daemonization process), the program can be altered to work on Windows or Mac.

Web Browser Availability

This bot uses Selenium to scrape data from the internet. Selenium uses a webdriver to utlize a system's existing web browser to simulate a user accessing the website. The bot is designed to work with a Chrome based browser (Chrome, Chromium, Vivaldi, etc.), but can be altered to work with Firefox, Safari, or Opera.

To use a different browser, make the necessary changes in baseball_spider.py's _prep_driver() function. Otherwise, ensure that a chrome-based browser is downloaded to its default location (/usr/bin/chromium-browser for Chromium on Ubuntu).

.env

You will need to create a .env file in your working directory. This file needs to contain four things:

  • DISCORD_TOKEN={The token for your bot}
  • DISCORD_GUILD={The name of the guild your bot will be hosted on}
  • DISCORD_TARGET_CHANNEL={The channel ID you want the bot to post scheduled updates}
  • DISCORD_NOTIFICATION_CHANNEL={The channel ID where the bot should notify that updates have occurred}

requirements.txt

Be sure to install all libraries in requirements.txt via pip install -r requirements.txt

Running the Bot

To run the bot simply type python bot.py while in the working directory of this project. If all the steps were properly followed in the setup section, you should see the bot connect to the webdriver and then begin waiting.

Logs

Log files are generated for this bot and stored in the logs folder. They will log every action the bot performs, every error that occurs, and the time these events took place.

A new log file is generated for each time the bot is spun up. An example of a log can be found here

You might also like...
A python bot using the Selenium library to auto-buy specified sneakers on the nike.com website.

Sneaker-Bot-UK A python bot using the Selenium library to auto-buy specified sneakers on the nike.com website. This bot is still in development and is

A twitter bot that simply replies with a beautiful screenshot of the tweet, powered by poet.so
A twitter bot that simply replies with a beautiful screenshot of the tweet, powered by poet.so

Poet this! Replies with a beautiful screenshot of the tweet, powered by poet.so Installation git clone https://github.com/dhravya/poet-this.git cd po

A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax

1.0 Release See here for details about breaking changes with the upcoming 1.0 release: https://github.com/taverntesting/tavern/issues/495 Easier API t

Turn any OpenAPI2/3 and Postman Collection file into an API server with mocking, transformations and validations.

Prism is a set of packages for API mocking and contract testing with OpenAPI v2 (formerly known as Swagger) and OpenAPI v3.x. Mock Servers: Life-like

To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations

To automate the generation and validation tests of COSE/CBOR Codes and it's base45/2D Code representations, a lot of data has to be collected to ensure the variance of the tests. This respository was established to collect a lot of different test data and related test cases of different member states in a standardized manner. Each member state can generate a folder in this section.

Test django schema and data migrations, including migrations' order and best practices.

django-test-migrations Features Allows to test django schema and data migrations Allows to test both forward and rollback migrations Allows to test th

A simple Python script I wrote that scrapes NASA's James Webb Space Telescope tracker website using Selenium and returns its current status and location.

A simple Python script I wrote that scrapes NASA's James Webb Space Telescope tracker website using Selenium and returns its current status and location.

Hypothesis is a powerful, flexible, and easy to use library for property-based testing.

Hypothesis Hypothesis is a family of testing libraries which let you write tests parametrized by a source of examples. A Hypothesis implementation the

Generic automation framework for acceptance testing and RPA

Robot Framework Introduction Installation Example Usage Documentation Support and contact Contributing License Introduction Robot Framework is a gener

Owner
Benjamin Hammack
Data Scientist at Nielsen; MS in Data Science (bioinformatics concentration); BS in Computer Science.
Benjamin Hammack
Minimal example of how to use pytest with automated 'devops' style automated test runs

Pytest python example with automated testing This is a minimal viable example of pytest with an automated run of tests for every push/merge into the m

Karma Computing 2 Jan 2, 2022
Yet another python home automation project. Because a smart light is more than just on or off

Automate home Yet another home automation project because a smart light is more than just on or off. Overview When talking about home automation there

Maja Massarini 62 Oct 10, 2022
An Instagram bot that can mass text users, receive and read a text, and store it somewhere with user details.

Instagram Bot ?? July 14, 2021 Overview ?? A multifunctionality automated instagram bot that can mass text users, receive and read a message and store

Abhilash Datta 14 Dec 6, 2022
This is a bot that can type without any assistance and have incredible speed.

BulldozerType This is a bot that can type without any assistance and have incredible speed. This bot currently only works on the site https://onlinety

null 1 Jan 3, 2022
AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.

AutoExploitSwagger is an automated API security testing exploit tool that can be combined with xray, BurpSuite and other scanners.

null 6 Jan 28, 2022
tidevice can be used to communicate with iPhone device

tidevice can be used to communicate with iPhone device

Alibaba 1.8k Jan 8, 2023
This is a Python script for Github Bot which uses Selenium to Automate things.

github-follow-unfollow-bot This is a Python script for Github Bot which uses Selenium to Automate things. Pre-requisites :- Python A Github Account Re

Chaudhary Hamdan 10 Jul 1, 2022
How to Create a YouTube Bot that Increases Views using Python Programming Language

YouTube-Bot-in-Python-Selenium How to Create a YouTube Bot that Increases Views using Python Programming Language. The app is for educational purpose

Edna 14 Jan 3, 2023
Scraping Bot for the Covid19 vaccination website of the Canton of Zurich, Switzerland.

Hi ?? , I'm David A passionate developer from France. ?? I’m currently learning Kotlin, ReactJS and Kubernetes ??‍?? All of my projects are available

null 1 Nov 14, 2021
Instagram unfollowing bot. If this script is executed that specific accounts following will be reduced

Instagram-Unfollower-Bot Instagram unfollowing bot. If this script is executed that specific accounts following will be reduced.

Biswarup Bhattacharjee 1 Dec 24, 2021