From 56d4158d8e7edfe8c0e36d38dff9eaf7374921b2 Mon Sep 17 00:00:00 2001 From: phlux Date: Sun, 10 Nov 2024 21:22:50 -0500 Subject: [PATCH] Rename --- README.md | 120 ++++++++++++++++---------------------------- cmd/main.go | 4 +- internal/bot/bot.go | 6 +-- 3 files changed, 48 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index 7018391..d1d9f7c 100644 --- a/README.md +++ b/README.md @@ -1,105 +1,71 @@ -# Discord College Football Bot -A Discord bot written in Go that provides up-to-date college football scores and schedules. It responds to commands to show recent or upcoming games for specific teams using the [College Football Data API](https://collegefootballdata.com/). +# Discord Scores Bot + +**Discord Scores Bot** is a powerful, user-friendly bot designed to bring real-time college sports scores and updates directly to your Discord server. Whether you follow college football or basketball, this bot keeps you up-to-date with live game information, final scores, and upcoming match schedules. ## Features -- Retrieves college football scores by team, including live scores (for Patreon members) -- Provides upcoming game schedules if a game hasn’t started -- Designed to run on a Discord server, responds to commands in real-time +- **Live Score Updates**: Get real-time scores for ongoing games. +- **Upcoming Matches**: Check when your favorite teams are playing next. +- **Final Scores**: View results from completed games. +- **Team Search**: Search for scores using team names. +- **Date & Week Specification**: Specify dates (e.g., `MM/DD`) for basketball and weeks for football to view related games. -## Commands +## Supported Commands -- **!s ``** — Retrieves the score for the most recent game or the upcoming game schedule if the game hasn’t started. - -Example: -``` -!s Alabama -``` +- `!cfb [team] [week]`: Retrieves college football game details for the specified team and week (current week if not specified). +- `!cbb [team] [MM/DD]`: Retrieves college basketball game details for the specified team and date (today's date if not specified). -## Setup +## Installation -### Prerequisites - -- **Go** (1.19 or later) -- **College Football Data API key**: Sign up at [College Football Data](https://collegefootballdata.com/) and obtain an API key. -- **Discord Bot Token**: Set up a bot on the [Discord Developer Portal](https://discord.com/developers/applications) to obtain a token. - -### Installation - -1. **Clone the repository**: +1. Clone this repository: ```bash - git clone https://github.com/yourusername/discord-cfb-bot.git - cd discord-cfb-bot + git clone https://your-repo-url/discord-scores-bot.git + cd discord-scores-bot ``` -2. **Configure API keys**: - - In `config/config.go`, set the `CFBDAPIKey` with your College Football Data API key and your Discord bot token. - -3. **Run the bot**: - - To test locally: - ```bash - go run main.go - ``` - - To run in the background: - - Use `nohup`, `screen`, `tmux`, or create a `systemd` service (see below for options). - -### Running the Bot in the Background - -You can keep the bot running in the background by using tools like `nohup`, `screen`, or `tmux`. For production servers, consider creating a `systemd` service. - -Example with `nohup`: -```bash -nohup go run main.go > bot.log 2>&1 & -``` - -### Deployment with `systemd` (Linux) - -1. Create a `systemd` service file at `/etc/systemd/system/discord-cfb-bot.service`: - ```ini - [Unit] - Description=Discord College Football Bot - After=network.target - - [Service] - ExecStart=/usr/local/go/bin/go run /path/to/main.go - WorkingDirectory=/path/to/discord-cfb-bot - StandardOutput=append:/path/to/bot.log - StandardError=append:/path/to/bot.log - Restart=always - User=yourusername - - [Install] - WantedBy=multi-user.target +2. Install dependencies: + ```bash + go mod tidy ``` -2. **Enable and start the service**: +3. Create a `.env` file and add your Discord bot token: + ```env + BOT_TOKEN=your-discord-bot-token + ``` + +4. Run the bot: ```bash - sudo systemctl enable discord-cfb-bot - sudo systemctl start discord-cfb-bot + go run cmd/main.go ``` ## Usage -Invite the bot to your server and type commands in any text channel where the bot has permissions. For example: -``` -!s Texas A&M -``` +- Invite the bot to your Discord server and type `!cfb [team] [week]` or `!cbb [team] [MM/DD]` to get game information. +- If a date or week is not specified, the bot defaults to today's date or the current week. -The bot will reply with the score or the upcoming game schedule for the team. +## Examples -## Project Structure +- `!cfb Alabama`: Get details of Alabama's football games for the current week. +- `!cbb Duke 11/10`: Get details of Duke's basketball game on November 10th. -- `main.go`: Entry point of the bot -- `config/config.go`: Configuration file for the API keys and other settings -- `clients/cfbd_client.go`: Client for interacting with the College Football Data API -- `bot/bot.go`: Discord bot setup and command handling +## Configuration -## Contributions +The bot is configured to use pre-defined API endpoints for fetching scores: +- College football: `https://ncaa.ewnix.net/football/fbs` +- College basketball: `https://ncaa.ewnix.net/scoreboard/basketball-men/d1` -Contributions are welcome! Feel free to submit a pull request to improve the bot or add new features. +Ensure that your bot has the necessary permissions to read and send messages in the channels where it's active. + +## Contribution + +Contributions are welcome! Feel free to open an issue or submit a pull request to improve the bot or add new features. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. +--- + +Stay connected with your favorite college sports and enhance your Discord experience with **Discord Scores Bot**! + diff --git a/cmd/main.go b/cmd/main.go index 8f2604e..204969d 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -1,8 +1,8 @@ package main import ( - "discord-cfb-bot/internal/bot" - "discord-cfb-bot/config" + "discord-scores-bot/internal/bot" + "discord-scores-bot/config" "fmt" ) diff --git a/internal/bot/bot.go b/internal/bot/bot.go index f1c2d54..5a6421a 100644 --- a/internal/bot/bot.go +++ b/internal/bot/bot.go @@ -1,9 +1,9 @@ package bot import ( - "discord-cfb-bot/config" - cfbClient "discord-cfb-bot/internal/clients/cfb" - cbbClient "discord-cfb-bot/internal/clients/cbb" + "discord-scores-bot/config" + cfbClient "discord-scores-bot/internal/clients/cfb" + cbbClient "discord-scores-bot/internal/clients/cbb" "github.com/bwmarrin/discordgo" "fmt" "strings"