He's a very simple bot that monitors Twitch chat for clips and auto-posts them to Discord.
Like this!
He runs on a diet of nodejs and twitch-js. He needs to live on a server (Like an Amazon EC2 instance). I use a Pocket C.H.I.P. to host Clive.
Some assembly required (it helps to be familiar with node).
Before starting, make sure nodejs v12 or later is installed. You will also need a webhook for the Discord channel where these clips will be posted.
- Open terminal.
- Navigate to a directory (like
~/Developer
). - Run
git clone https://github.com/mangosango/Clive.git && cd Clive
. - Run
npm install
- Copy
.env-exmaple
to.env
* - Open
.env
in a text editor (like atom). - Refer to the settings flags below.
- Save
.env
. - In terminal, run
npm start
. - ???
- Profit.
* .env file is primarily for development and debugging. Environment variables are preferred for production environment. To use environment variables, you can set all the flags below. TWITCH_CHANNELS
should be a space limited set of channel_name
s. You can set these in the provided clive.service
file, or by using the export
command. Here's a short guide. on how to use systemd.
SETTING_NAME
(required or optional to be set) [default production setting]
-
NODE_ENV
(optional) [production]- Set to dev for development or production for normal usage
-
LOG_LEVEL
(optional) [error]- Set to which level of logging you'd like.
debug
is good for development.info
orerror
is good for normal usage. Checkout Winston for more info.
- Set to which level of logging you'd like.
-
LOG_FILE
(required) [/var/log/clive.log]- Set this to the location of where you would like a log file. Make sure Clive has write permissions!
-
DB_FILE
(required) [db.json]- Set this to the location of your JSON db file. If running as a service make sure to use the absolute file path.
-
DISCORD_WEBHOOK_URL
(required)- Set this to your Discord webhook for the channel you want Clive to post in! Discord webhook URL
-
TWITCH_CHANNELS
(required)- Set the channels you want Clive to monitor for clips. These are also used for
RESTRICT_CHANNELS
If you wanted to watch for clips inMonstercat
's chat, you would use"monstercat"
. If you wanted to monitor multiple channels, you would use"monstercat mrchowderclam updownleftdie"
.
- Set the channels you want Clive to monitor for clips. These are also used for
-
TWITCH_CLIENT_ID
(optional, suggested) [null]- Needed for Twitch API functionality. This allows Clive to get more data about the clip for its messages! More info: Twitch Dev Getting Started
-
TWITCH_CLIENT_SECRET
(optional, suggested) [null]- Needed along with the client ID for Twitch API functionality. This allows Clive to get more data about the clip for its messages! More info: Twitch Dev Getting Started
-
RESTRICT_CHANNELS
(optional) [true]- REQUIRES:
TWITCH_CLIENT_ID
to be set. If true, only shares clips that are listed inTWITCH_CHANNELS
.
- REQUIRES:
-
MODS_ONLY
(optional) [false]- If true, only allows mods to post clips.
-
SUBS_ONLY
(optional) [false]- If true, only allows subscribers to post clips.
-
BROADCASTER_ONLY
(optional) [false]- If true, only allows the broadcaster to post clips. NOTE: broadcaster is not considered a mod by default on Twitch.
-
RICH_EMBED
(optional) [true]- REQUIRES:
TWICH_CLIENT_ID
to be set. If true will post two messages to Discord the first being the video and the second being a rich embed box that contains more information about the clip. Two separate messages are necessary because Discord doesn't allow settingvideo
element inside of the rich embed object.
- REQUIRES:
MODS_ONLY
, SUBS_ONLY
, and BROADCASTER_ONLY
can be combined. Example: turning all BROADCASTER_ONLY
and SUBS_ONLY
will only share clips posted by those two groups. All three set to false
on means anyone can post a clip link. Be careful if you are not using a TWITCH_CLIENT_ID
AND RESTRICT_CHANNELS
or else ANY clips will be shared to your Discord.
- Having a UI or hosting this somewhere would be nice.
- Make clive an actual Discord bot, but that would require actual work lol.
Option to only send clips of a certain channel or channels.Option to only send clips posted by broadcaster, mods, or subs.Set theDISCORD_WEBHOOK_URL
to pull from an evar or something.Track previously posted twitch clipsUse Discord Rich Embed messagesMFW the Readme is bigger than the app LUL
- Create your own feature branch (using
git checkout -b ...
or whatever you want to use). - Write some nice code. Commit it! Push it!
- Use Github's excellent pull request feature to submit a PR.
- Someone will review your PR and merge to master!
- Yay.