-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from rockerBOO/0.2.1-beta2
Refactored. Simplified dependencies. Moving config to app start. Tests
- Loading branch information
Showing
45 changed files
with
923 additions
and
714 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,36 @@ | ||
Blur | ||
==== | ||
|
||
Chat Bot for Streamers. Built to scale. Fast, efficient processing. | ||
Twitch Chat Bot | ||
|
||
![Elixir CI](https://github.com/rockerBOO/blur/workflows/Elixir%20CI/badge.svg) | ||
[![Coverage Status](https://coveralls.io/repos/github/rockerBOO/blur/badge.svg)](https://coveralls.io/github/rockerBOO/blur) | ||
|
||
## Install | ||
|
||
To setup, the configuration options are in `.env`. `.env.example` is setup to show how to configure, and just rename to `.env`. | ||
First, add Blur to your mix.exs dependencies: | ||
|
||
```elixir | ||
# The key generated from twitchtmi.com/chat | ||
export TWITCH_CHAT_KEY=oauth: | ||
|
||
# Username on Twitch for the Bot. | ||
# It needs to match to the user of the access token/chat key. | ||
export TWITCH_USERNAME= | ||
|
||
# OPTIONAL. This takes precidence over the chat key for more intergrated options (authenticated calls to twitch) | ||
# export TWITCH_ACCESS_TOKEN= | ||
def deps do | ||
[{:blur, "~> 0.2"}] | ||
end | ||
``` | ||
|
||
## To Run | ||
|
||
`source .env && iex -S mix` | ||
|
||
## Configuration for Channels | ||
Then, update your dependencies: | ||
|
||
Configuration for channels are stored in `data/#channel/` | ||
```sh-session | ||
$ mix deps.get | ||
``` | ||
|
||
* `data/rockerboo/commands.json` | ||
* Commands list | ||
* `data/rockerboo/config.json` | ||
* Configuration options for the channel | ||
* `data/rockerboo/aliases.json` | ||
* Stores aliases for commmands | ||
To setup, the configuration options are in `.env`. `.env.example` is setup to show how to configure, and just rename to `.env`. | ||
|
||
### `data/#channel/config.json` | ||
```js | ||
{ | ||
"messages": "on" | ||
} | ||
``` | ||
```elixir | ||
# The key generated from https://twitchapps.com/tmi/. | ||
export TWITCH_CHAT_KEY=oauth: | ||
|
||
### `data/#channel/commands.json` | ||
```js | ||
{ | ||
"hello": ["say", "Hello"], | ||
"help": ["say", "You need help"], | ||
"follower": ["cmd", "follower"], | ||
"followed": ["cmd", "followed"], | ||
"flip": ["say", "(╯°□°)╯︵┻━┻"], | ||
"song": ["cmd", "song"], | ||
"highlight": ["cmd", "highlight"] | ||
} | ||
# Username on Twitch for the Bot. | ||
# It needs to match to the user of the access token/chat key. | ||
export TWITCH_USERNAME= | ||
``` | ||
|
||
|
||
### `data/#channel/aliases.json` | ||
```js | ||
{ | ||
"bealight": "bealright", | ||
"bot": "elirc", | ||
"glacier": "theme", | ||
"xfile": "xfiles", | ||
"x-file": "xfiles", | ||
"x-files": "xfiles", | ||
"h": "help", | ||
"playlist": "lastfm", | ||
"coming": "getsmeeverytime", | ||
"63": "speedlimit", | ||
"soundslist": "soundlist", | ||
"sounds": "soundlist", | ||
"table": "flip", | ||
"tableflip": "flip" | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule Blur.App do | ||
use Supervisor | ||
|
||
def start! do | ||
Supervisor.start_link(__MODULE__, [], name: :blur) | ||
end | ||
|
||
@spec start(atom, list) :: GenServer.on_start() | ||
def start(_type, [user, channels]) do | ||
Supervisor.start_link(__MODULE__, [user, channels], name: :blur) | ||
end | ||
|
||
@impl Supervisor | ||
def init([user, channels]) do | ||
{:ok, client} = ExIRC.start_link!() | ||
|
||
children = [ | ||
{Blur.Channels, []}, | ||
{Blur.Users, []}, | ||
# {Blur.IRC.Client, [client]}, | ||
{Blur.IRC.Connection, [client, user]}, | ||
{Blur.IRC.Login, [client, channels]}, | ||
{Blur.IRC.Channel, [client]}, | ||
{Blur.IRC.Message, [client]} | ||
] | ||
|
||
Supervisor.init(children, strategy: :one_for_one) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.