From f0607b82e7178d5951c1ff71c609d3255a37abf1 Mon Sep 17 00:00:00 2001 From: deflax Date: Tue, 22 Mar 2022 20:22:37 -0400 Subject: [PATCH] add code from codecat --- .dockerignore | 4 ++ .gitignore | 110 ++++---------------------------------------------- README.md | 45 ++++++++++++++++++++- 3 files changed, 56 insertions(+), 103 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..30babd5 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,4 @@ +node_modules +yarn.lock +package-lock.json +config.toml diff --git a/.gitignore b/.gitignore index 6704566..efb1551 100644 --- a/.gitignore +++ b/.gitignore @@ -1,104 +1,10 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* +# Internal +config/ +config.toml +local/ +modules/livenp.js -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories +# Node node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# Next.js build output -.next - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and *not* Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port +package-lock.json +yarn.lock diff --git a/README.md b/README.md index 61f27eb..9d1c157 100644 --- a/README.md +++ b/README.md @@ -1 +1,44 @@ -# radiobot \ No newline at end of file +# Radiobot + +Radio Bot based on codecat/reddit-radio + +## Features + +* Live radio re-streaming to voice channels (using multiple bot users), automatically turned on/off when someone joins/leaves the bound channel. +* Other cool things. + + +## Modules +A module is a class in the `modules` folder. It accepts the following methods: + +* `constructor(config, client, bot)` where `config` is the object directly from the config file, `client` is the Discord client, and `bot` is the `RedditRadio` object. +* `onCmdXxxx(msg, ...)` where `Xxxx` is a command name like `.xxxx`. +* `onTick()` is called every second. +* `onMessage(msg)` is called whenever a message is sent in any channel. Return `false` if the message can pass through to other commands and handlers, or `true` to stop that from happening. + + +## (Optional) How to run using Docker +You can use Docker and a mounted volume to easily run Reddit Radio. + +The Reddit Radio Docker image is publically available on Docker Hub and can be found [here](https://hub.docker.com/r/codecatt/reddit-radio) and are automatically built each time a change is made to the master branch. + +### How to run using built image +1. Create a folder where you'd like to run the docker image +2. Create a folder called `config` or similiar to keep your configuration in +3. Make a copy of `config.example.toml` called `config.toml` and place it in your `config` folder +4. Edit the config file +5. Run the following command `docker run -d --name reddit-radio -v $(pwd)/config:/app/config codecatt/reddit-radio:latest` + +### Running using Docker from the repo +1. Clone this repo + `git clone https://github.com/codecat/reddit-radio.git` +2. Build the Docker image + `docker build . -t reddit-radio` +3. Create a folder called `config` or similiar to keep your configuration in +4. Make a copy of `config.example.toml` called `config.toml` and place it in your `config` folder +5. Edit the config file +6. Run the following command + `docker run -d --name reddit-radio -v $(pwd)/config:/app/config reddit-radio` + +Note: For development you could map your whole code directory as follows: +`docker run -d --name reddit-radio -v $(pwd):/app reddit-radio`