Skip to content

Commit

Permalink
further style github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecM33 committed Jul 6, 2024
1 parent af0efe8 commit 08083a6
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 74 deletions.
1 change: 1 addition & 0 deletions docs/images/github-mark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 95 additions & 66 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,80 +22,109 @@
font-size: 18px;
background-color: #03142d;
color: #e7e7e7;
font-family: "Segoe UI", Arial, sans-serif
font-family: "Segoe UI Light", Arial, sans-serif;
margin-bottom: 2em;
}
img {
.bot-demo-img {
border-radius: 5px;
border: 1px solid #4d4d4d;
width: 100%;
max-width: 27em;
margin: 1em 0;
}
#byline img {
width: 30px;
height: 30px;
margin-left: 5px;
}
a {
color: whitesmoke;
}
#byline a {
display: flex;
color: whitesmoke;
align-items: center;
}
#byline {
display: flex;
justify-content: space-between;
}
#byline p {
margin-right: 1em;
}
h2 {
padding: 5px;
background-color: #4d4d4d3b;
border-radius: 5px;
}
#header {
margin-bottom: 1em;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
#header h1 {
margin: 0;
}
</style>
</head>
<body>
<h1>MLB Gameday Bot ⚾</h1>
<p id="intro">A bot that integrates with the MLB Stats API to track your team of choice.
When running, the bot periodically polls for games in a 48-hour window centered on the current date. Whichever game is closest in time is considered the "current" game, and will be the game for which a lot of the commands returns data. If a game is live, the bot subscribes to its MLB.com Gameday live feed, and in turn reports events to any number of subscribed Discord channels.
</p>
<img src="./images/screenshots/gameday_feed.png"/>
<p>
The embeds are styled with contrasting colors from each team's color set. For balls in play, the bot will give Statcast metrics.
This includes not only exit velo, launch angle, and distance, but also xBA and HR/Park, which are sourced separately from the
MLB Savant site. By default, the bot will report the result of each at bat, plus any key events that happen during at-bats,
such as baserunning events. If this is too much, the bot can be configured to report scoring plays only. Furthermore, if you wish
to avoid spoilers for people watching or listening on a delay, you can provide a delay from 0-180 seconds when subscribing.

For example, in a server for the Guardians, the bot has provided nice context right in the chat where people are following the game.
You can of course personalize it to have a bit more flair for your team:
</p>
<img src="./images/screenshots/personalized_gameday.png"/>

<h1 class="command-header">/lineup</h1>

<img src="./images/screenshots/lineup.png"/>

<h1 class="command-header">/starters</h1>

<img src="./images/screenshots/starters.png"/>

<h1 class="command-header">/box_score</h1>

<img src="./images/screenshots/box_score.png"/>

<h1 class="command-header">/line_score</h1>

<img src="./images/screenshots/line_score.png"/>

<h1 class="command-header">/pitcher</h1>

<img src="./images/screenshots/pitcher.png"/>

<h1 class="command-header">/batter</h1>

<img src="./images/screenshots/batter.png"/>

<h1 class="command-header">/scoring_plays</h1>

<img src="./images/screenshots/scoring_plays.png"/>

<h1 class="command-header">/highlights</h1>

<img src="./images/screenshots/highlights.png"/>

<h1 class="command-header">/standings</h1>

<img src="./images/screenshots/standings.png"/>

<h1 class="command-header">/schedule</h1>

<img src="./images/screenshots/schedule.png"/>

<h1 class="command-header">/weather</h1>

<img src="./images/screenshots/weather.png"/>

<h1 class="command-header">/attendance</h1>

<img src="images/screenshots/attendance.png"/>
<div id="header">
<h1>MLB Gameday Discord Bot ⚾</h1>
<div id="byline">
<p>By Alec (AlecM33)</p>
<a href="https://github.com/AlecM33/gameday-bot">View on Github<img src="./images/github-mark.svg" alt="github logo"></a>
</div>
<p>
This bot and its author are not affiliated with the MLB. The bot uses the MLB Stats API, which is subject to
the notice posted at <a href="http://gdx.mlb.com/components/copyright.txt">http://gdx.mlb.com/components/copyright.txt</a>
</p>
</div>
<p id="intro">A Discord bot that integrates with the MLB Stats API to track your team of choice.
When running, the bot periodically polls for recent, live, or upcoming games. Whichever game is closest in time is
considered the "current" game, and will be the game for which a lot of the commands returns data. If there's a doubleheader, the bot may ask you to specify which game.
If a game is live, the bot subscribes to its MLB.com Gameday live feed, and in turn reports events to any number of subscribed Discord channels.
</p>
<h1>Demos</h1>
<h2>/gameday_subscribe</h2>
<p>This is the centerpiece of the bot's functionality. For whichever team you configure it for, the bot will detect
when a game is live and report those updates to any subscribed Discord channels, respecting each channel's preferences:</p>
<img class="bot-demo-img" alt="gameday reporting" src="./images/screenshots/gameday_feed.png"/>
<p>
The embeds are styled with contrasting colors from each team's color set. For balls in play, the bot will give Statcast metrics.
This includes not only exit velo, launch angle, and distance, but also xBA and HR/Park, which are sourced separately from the
MLB Savant site. By default, the bot will report the result of each at bat, plus any key events that happen during at-bats,
such as baserunning events. If this is too much, the bot can be configured to report scoring plays only. Furthermore, if you wish
to avoid spoilers for people watching or listening on a delay, you can provide a delay from 0-180 seconds when subscribing.

For example, in a server for the Guardians, the bot has provided nice context right in the chat where people are following the game.
You can of course personalize it to have a bit more flair for your team:
</p>
<img class="bot-demo-img" alt="personalized bot reporting" src="./images/screenshots/personalized_gameday.png"/>
<h2 class="command-header">/lineup</h2>
<img class="bot-demo-img" alt="lineup" src="./images/screenshots/lineup.png"/>
<h2 class="command-header">/starters</h2>
<img class="bot-demo-img" alt="starters" src="./images/screenshots/starters.png"/>
<h2 class="command-header">/box_score</h2>
<img class="bot-demo-img" alt="box score" src="./images/screenshots/box_score.png"/>
<h2 class="command-header">/line_score</h2>
<img class="bot-demo-img" alt="line score" src="./images/screenshots/line_score.png"/>
<h2 class="command-header">/pitcher</h2>
<img class="bot-demo-img" alt="pitcher" src="./images/screenshots/pitcher.png"/>
<h2 class="command-header">/batter</h2>
<img class="bot-demo-img" alt="batter" src="./images/screenshots/batter.png"/>
<h2 class="command-header">/scoring_plays</h2>
<img class="bot-demo-img" alt="scoring plays" src="./images/screenshots/scoring_plays.png"/>
<h2 class="command-header">/highlights</h2>
<img class="bot-demo-img" alt="highlights" src="./images/screenshots/highlights.png"/>
<h2 class="command-header">/standings</h2>
<img class="bot-demo-img" alt="standings" src="./images/screenshots/standings.png"/>
<h2 class="command-header">/schedule</h2>
<img class="bot-demo-img" alt="schedule" src="./images/screenshots/schedule.png"/>
<h2 class="command-header">/weather</h2>
<img class="bot-demo-img" alt="weather" src="./images/screenshots/weather.png"/>
<h2 class="command-header">/attendance</h2>
<img class="bot-demo-img" alt="attendance" src="images/screenshots/attendance.png"/>
</body>
</html>
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const gameday = require('./modules/gameday');
const globalCache = require("./modules/global-cache");
const queries = require("./database/queries");
const { LOG_LEVEL } = require('./config/globals');
const LOGGER = require('./modules/logger').init(process.env.LOG_LEVEL || LOG_LEVEL.INFO);
const LOGGER = require('./modules/logger')(process.env.LOG_LEVEL?.trim() || LOG_LEVEL.INFO);

const BOT = new Client({
intents: [
Expand Down
2 changes: 1 addition & 1 deletion modules/MLB-API-util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const globals = require('../config/globals');
const ReconnectingWebSocket = require('reconnecting-websocket');
const { LOG_LEVEL } = require('../config/globals');
const LOGGER = require('./logger').init(process.env.LOG_LEVEL || LOG_LEVEL.INFO);
const LOGGER = require('./logger')(process.env.LOG_LEVEL?.trim() || LOG_LEVEL.INFO);

const endpoints = {
schedule: (startDate = '', endDate = '', teamId = parseInt(process.env.TEAM_ID)) => {
Expand Down
2 changes: 1 addition & 1 deletion modules/command-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const mlbAPIUtil = require('./MLB-API-util');
const jsdom = require('jsdom');
const globals = require('../config/globals');
const puppeteer = require('puppeteer');
const LOGGER = require('./logger').init(process.env.LOG_LEVEL || globals.LOG_LEVEL.INFO);
const LOGGER = require('./logger')(process.env.LOG_LEVEL?.trim() || globals.LOG_LEVEL.INFO);

module.exports = {
getLineupCardTable: async (game) => {
Expand Down
2 changes: 1 addition & 1 deletion modules/diff-patch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const globalCache = require('./global-cache');
const globals = require('../config/globals');
const LOGGER = require('./logger').init(process.env.LOG_LEVEL || globals.LOG_LEVEL.INFO);
const LOGGER = require('./logger')(process.env.LOG_LEVEL?.trim() || globals.LOG_LEVEL.INFO);

/*
This module concerns updating the base MLB gameday object (AKA "GUMBO") with changes derived from the "diffPatch" resource
Expand Down
2 changes: 1 addition & 1 deletion modules/gameday.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const diffPatch = require('./diff-patch');
const currentPlayProcessor = require('./current-play-processor');
const { EmbedBuilder } = require('discord.js');
const globals = require('../config/globals');
const LOGGER = require('./logger').init(process.env.LOG_LEVEL || globals.LOG_LEVEL.INFO);
const LOGGER = require('./logger')(process.env.LOG_LEVEL?.trim() || globals.LOG_LEVEL.INFO);
const ColorContrastChecker = require('color-contrast-checker');

module.exports = {
Expand Down
4 changes: 1 addition & 3 deletions modules/logger.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { LOG_LEVEL } = require('../config/globals');

module.exports = {
init: (logLevel = LOG_LEVEL.INFO) => {
module.exports = function (logLevel = LOG_LEVEL.INFO) {
return {
logLevel,
info (message = '') {
Expand Down Expand Up @@ -44,5 +43,4 @@ module.exports = {
console.error('TRACE ', now.toGMTString(), ': ', message);
}
};
}
};

0 comments on commit 08083a6

Please sign in to comment.