From 8d76596ebf94efaa8f01a0d653954f1101a05286 Mon Sep 17 00:00:00 2001 From: BreadTube Date: Wed, 21 Jan 2026 22:46:13 +0900 Subject: [PATCH] Add README * Optional `--guild-id` is now positional (thus mandatory) and no longer have a default id set to the breadtube discord server --- .gitignore | 3 ++- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ data/.gitkeep | 0 pyproject.toml | 2 +- start.py | 2 +- 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 README.md create mode 100644 data/.gitkeep diff --git a/.gitignore b/.gitignore index 9ee23a1..d2f7327 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.pyc -/data +/data/* +!/data/.gitkeep diff --git a/README.md b/README.md new file mode 100644 index 0000000..250a931 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ +# Breadtube Bot + +This is the bot for the breadtube application for Discord. + + +## Install + +The breadtube bot needs Python to be installed (minimum tested version is 3.10). There is no other dependencies. + + +## Usage + +The bot needs 2 token: +* A discord bot token in `data/` : in your discord application's `settings` under `Bot` you'll have to click on the `Reset Token` button (even if you just created a new application) to retreive this token. The token will only appear once, after resetting it. +* A google api token in `data/` : you can create one from the google API console [https://console.cloud.google.com/apis/credentials](https://console.cloud.google.com/apis/credentials), you should have a `Create credentials` button in the top menu then select `API key`. You can restrict the key to only `Youtube Data API` as no other API will be used by the bot. + +The Google API Key is only used to search channel from their URL and find their ID. + +Starting manually the bot is as simple as running the command `python3 start.py [discord-server-id]`. + +### Using a systemd service (Linux) + +All of the following needs to be done as root (administrator privilege). + +If you want the bot to run automatically on a Linux server you can setup a systemd service by adding a file in `/etc/systemd/system`, like `/etc/systemd/system/breadtube-bot.service` (here the service name will be `breadtube-bot`) then you need to run `systemctl daemon-reload` to read/accept the new service. From here `systemctl` can be used with the commands `enable`/`disable` to make the service run at startup and `start`/`stop`/`status` to manually start, stop or check if it is running (example: `systemctl start breadtube-bot`). + +Additionnaly you can check all the logs of a service using `journalctl -u baguettetube-bot` (`-f` to 'follow' in real-time the logs). + +Sample of a service file running from a created `breadtube` user (it is highly recommended to run as a isolated user): + +``` +[Unit] +Description=Run Breadtube Bot +After=network.target + +[Service] +Type=simple +User=breadtube +Group=breadtube +WorkingDirectory=/home/breadtube/[path-to-source-code] +ExecStart=python3 start.py [discord-server-id] + +[Install] +WantedBy=default.target +``` diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index a47a898..5e767dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "bot-discord" version = "0.0.1" -requires-python = ">=3.11" +requires-python = ">=3.10" # dependencies = [] [project.optional-dependencies] diff --git a/start.py b/start.py index a0434af..f1ebec9 100644 --- a/start.py +++ b/start.py @@ -7,7 +7,7 @@ from breadtube_bot.bot import Bot def main(): parser = ArgumentParser('BreadTube-bot') - parser.add_argument('--guild', type=int, default=1306964577812086824, help='Guild id to manage') + parser.add_argument('guild', type=int, help='Guild id (discord server) to manage') parser.add_argument('--debug', action='store_true', default=False, help='Run in debug mode (for logs)') arguments = parser.parse_args()