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

Owner
Benjamin Hammack
Data Scientist at Nielsen; MS in Data Science (bioinformatics concentration); BS in Computer Science.
Benjamin Hammack
A Django plugin for pytest.

Welcome to pytest-django! pytest-django allows you to test your Django project/applications with the pytest testing tool. Quick start / tutorial Chang

pytest-dev 1.1k Dec 31, 2022
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

909 Dec 15, 2022
Fail tests that take too long to run

GitHub | PyPI | Issues pytest-fail-slow is a pytest plugin for making tests fail that take too long to run. It adds a --fail-slow DURATION command-lin

John T. Wodder II 4 Nov 27, 2022
Webscreener is a tool for mass web domains pentesting.

Webscreener is a tool for mass web domains pentesting. It is used to take snapshots for domains that is generated by a tool like knockpy or Sublist3r. It cuts out most of the pentesting time by scree

Seekurity 3 Jun 07, 2021
A friendly wrapper for modern SQLAlchemy and Alembic

A friendly wrapper for modern SQLAlchemy (v1.4 or later) and Alembic. Documentation: https://jpsca.github.io/sqla-wrapper/ Includes: A SQLAlchemy wrap

Juan-Pablo Scaletti 129 Nov 28, 2022
Tattoo - System for automating the Gentoo arch testing process

Naming origin Well, naming things is very hard. Thankfully we have an excellent

Arthur Zamarin 4 Nov 07, 2022
Just a small test with lists in cython

Test for lists in cython Algorithm create a list of 10^4 lists each with 10^4 floats values (namely: 0.1) - 2 nested for iterate each list and compute

Federico Simonetta 32 Jul 23, 2022
Asyncio http mocking. Similar to the responses library used for 'requests'

aresponses an asyncio testing server for mocking external services Features Fast mocks using actual network connections allows mocking some types of n

93 Nov 16, 2022
This project is used to send a screenshot by email of your MyUMons schedule using Selenium python lib (headless mode)

MyUMonsSchedule Use MyUMonsSchedule python script to send a screenshot by email (Gmail) of your MyUMons schedule. If you use it on Windows, take care

Pierre-Louis D'Agostino 6 May 12, 2022
pytest plugin for distributed testing and loop-on-failures testing modes.

xdist: pytest distributed testing plugin The pytest-xdist plugin extends pytest with some unique test execution modes: test run parallelization: if yo

pytest-dev 1.1k Dec 30, 2022
A Simple Unit Test Matcher Library for Python 3

pychoir - Python Test Matchers for humans Super duper low cognitive overhead matching for Python developers reading or writing tests. Implemented in p

Antti Kajander 15 Sep 14, 2022
The Penetration Testers Framework (PTF) is a way for modular support for up-to-date tools.

The PenTesters Framework (PTF) is a Python script designed for Debian/Ubuntu/ArchLinux based distributions to create a similar and familiar distribution for Penetration Testing

trustedsec 4.5k Dec 28, 2022
Lightweight, scriptable browser as a service with an HTTP API

Splash - A javascript rendering service Splash is a javascript rendering service with an HTTP API. It's a lightweight browser with an HTTP API, implem

Scrapinghub 3.8k Jan 03, 2023
Statistical tests for the sequential locality of graphs

Statistical tests for the sequential locality of graphs You can assess the statistical significance of the sequential locality of an adjacency matrix

2 Nov 23, 2021
splinter - python test framework for web applications

splinter - python tool for testing web applications splinter is an open source tool for testing web applications using Python. It lets you automate br

Cobra Team 2.6k Dec 27, 2022
Set your Dynaconf environment to testing when running pytest

pytest-dynaconf Set your Dynaconf environment to testing when running pytest. Installation You can install "pytest-dynaconf" via pip from PyPI: $ pip

David Baumgold 3 Mar 11, 2022
Android automation project with pytest+appium

Android automation project with pytest+appium

1 Oct 28, 2021
Generates realistic traffic for load testing tile servers

Generates realistic traffic for load testing tile servers. Useful for: Measuring throughput, latency and concurrency of your tile serving stack. Ident

Brandon Liu 23 Dec 05, 2022
Fully functioning price detector built with selenium and python

Fully functioning price detector built with selenium and python

mark sikaundi 4 Mar 30, 2022
This is a pytest plugin, that enables you to test your code that relies on a running MongoDB database

This is a pytest plugin, that enables you to test your code that relies on a running MongoDB database. It allows you to specify fixtures for MongoDB process and client.

Clearcode 19 Oct 21, 2022