Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/electronic-mango/memes-discord-bot-docker-deployment
Combining Reddit API API and Random media Discord bot into a Memes Discord bot.
https://github.com/electronic-mango/memes-discord-bot-docker-deployment
discord discord-bot docker docker-compose memes reddit reddit-api
Last synced: 24 days ago
JSON representation
Combining Reddit API API and Random media Discord bot into a Memes Discord bot.
- Host: GitHub
- URL: https://github.com/electronic-mango/memes-discord-bot-docker-deployment
- Owner: Electronic-Mango
- License: gpl-3.0
- Created: 2022-08-06T20:16:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-15T14:59:45.000Z (6 months ago)
- Last Synced: 2024-06-15T15:26:04.769Z (6 months ago)
- Topics: discord, discord-bot, docker, docker-compose, memes, reddit, reddit-api
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Memes Discord bot Docker deployment
This repository provides an example of how you can combine my two other projects - [Random media Discord bot](https://github.com/Electronic-Mango/random-media-discord-bot) and [Reddit API API](https://github.com/Electronic-Mango/reddit-fastapi-api) - into a **Memes Discord bot** via [Docker Compose](https://docs.docker.com/compose/).
Both Reddit API API and Random media Discord bot are stored in this repository as git submodules.
## Table of contents
- [Updates to source code of submodules](#updates-to-source-code-of-submodules)
- [Configuration](#configuration)
- [Reddit API API](#reddit-api-api)
- [Random media Discord bot](#random-media-discord-bot)
- [Run the bot](#run-the-bot)## Updates to source code of submodules
[Reddit API API](https://github.com/Electronic-Mango/reddit-fastapi-api) and [Random media Discord bot](https://github.com/Electronic-Mango/random-media-discord-bot) bot are stored in this repository as git submodules.
After cloning this repository you have to update submodules to their correct versions.
Otherwise you won't be able to build their Docker images.
You can update the submodules via:```bash
git submodule update --init
```After future update to submodules you have to update them after rebasing this repository via:
```bash
git submodule update
```When Docker Compose is run with `--build` flag a new Docker images will be built, using Dockerfile in submodules, so it is important that they are up to date.
This and submodules repositories on GitHub use workflows to ensure, that source code here is always up to date.
## Configuration
### Reddit API API
[**Reddit API API**](https://github.com/Electronic-Mango/reddit-fastapi-api) configuration is stored in `./reddit-fastapi-api/config/custom_settings.yml` file.
This file isn't loaded into the Docker image, it's stored in Docker container mounted volume as `/config/custom_settings.yml`.`docker-compose.yml` configures `CUSTOM_SETTINGS_PATH` environment variable to point to correct settings YAML.
In order for the API to work you have to [create a Reddit app](https://old.reddit.com/prefs/apps/) and supply its ID and secret in `./reddit-fastapi-api/config/custom_settings.yml` in this project:
```yaml
reddit:
client:
# Your Reddit app ID
id:
# Your Reddit app secret
secret:
```Other parameters will use their default values stores in `settings.yml` file in Reddit API API itself.
You can use `./reddit-fastapi-api/config/custom_settings.yml` for additional configuration of Reddit API API, but for this bot only those two parameters are necessary.
More detailed description of configuration is available in [**Reddit API API**](https://github.com/Electronic-Mango/reddit-fastapi-api) project and its default settings YAML.
### Random media Discord bot
[**Random media Discord bot**](https://github.com/Electronic-Mango/random-media-discord-bot) is stored in `./random-media-discord-bot/config/` subdirectory.
It consists of two files:* `custom_settings.yml` - custom parameters of the bot, similarly to Reddit API API
* `custom_sources.yml` - file with sources of memes and copypastas to send by the botBoth files are not stored in the Docker image, but in containers mounted volume.
`docker-compose.yml` configures `CUSTOM_SETTINGS_PATH` environment variable to point to correct settings YAML.
Path to `custom_sources.yml` is defined at the end of `custom_settings.yml`.There's only one parameter needed to run the bot - its token.
It can be configured in `./random-media-discord-bot/config/custom_settings.yml`:```yaml
bot:
# Fill with your Discord bot token
token:
````custom_settings.yml` also contains configuration for command (and command group) names and descriptions, to better match the fact that it's going to be sending back memes and copypastas.
Other parameters will use their default values stores in `settings.yml` file in Random media Discord bot itself.
Both memes and copypastas are loaded from reddit articles.
You can check `custom_sources.yml` whether it fits your preference for subreddits to read data from.`media` section defines sources for images loaded via `/meme get` command.
`text` section defines sources for copypastas loaded via `/copypasta get` command.
You can change subreddits by supplying new entries, or modifying existing ones, and just change subreddit name in the URL.
More detailed description of API endpoints is available in [Reddit API API project page](https://github.com/Electronic-Mango/reddit-fastapi-api).More detailed description of settings YAML and sources YAML is available in [Random media Discord bot](https://github.com/Electronic-Mango/random-media-discord-bot) project and its default YAML files.
## Run the bot
You can run the bot in just a few steps:
1. Clone this repository
2. Update submodules with `git submodule update --init`
3. Fill Reddit app ID and secret in `./reddit-fastapi-api/config/custom_settings.yml`
4. Fill Discord bot token in `./random-media-discord-bot/config/custom_settings.yml`
5. Run `docker compose up -d --build`If you want to restart the containers without rebuilding the images you can skip `--build` flag.
Configuration files for both submodules are stored in the container as mounted volumes.
Changes to them will be applied after containers restart, you don't need to rebuild Docker images.