Code Monkey home page Code Monkey logo

timbot's Introduction

Timbot

Discord server

๐Ÿค– A simple, customizable Discord bot that announces Twitch streams going live (plus a bunch of silly extras).

Timbot

Features

  • ๐Ÿ“ข Monitor and announce Twitch channels going live with customizable @mentions.
  • ๐Ÿ”ด Live stream card that is automatically updated with the stream status, current game and viewership statistics.

Using the bot

You have two options:

  1. You can invite the instance I'm running to your server for monotonetim's twitch channels (it announces to #stream-announcements). This bot may not always be available, and it may do silly extra things sometimes.

  2. Or, run your own copy by following the instructions below, and customize it however you want.

Installation and setup

Prerequisites

This bot is built on Node.js. If you do not yet have Node installed, download and install the latest LTS version from the official website for your platform:

https://nodejs.org/en/download/

I recommend Node v10+.

Installation

To set up Timbot, download the latest repository ZIP or clone it using git:

git clone [email protected]:roydejong/timbot.git

Once installed, enter the directory and install the dependencies:

cd timbot
npm install

Getting required tokens

Note that you will need to set up some external applications:

Discord bot application

Your Discord bot needs to be registered as an application, and you will need a bot token (discord_bot_token in Timbot config).

Follow this guide for more information.

Twitch application

To connect to the Twitch API, you will need to register a new application in the Twitch Developers Console.

You will need to grab the Client ID (twitch_client_id in Timbot config).

Twitch OAuth token

To make things more complicated, all requests to the Twitch API need to be authenticated with an OAuth grant generated by your own application.

To begin the authorization flow, you'll need to complete the authorization prompt yourself:

https://id.twitch.tv/oauth2/authorize?client_id=<YOUR_CLIENT_ID_HERE>&response_type=token&redirect_uri=http://localhost

You can grab the access_token from the redirect URL in your browser, and store it as twitch_oauth_token in Timbot config.

Configuration

To configure Timbot, copy the included config-sample.json to config.json and enter or customize the values in the file.

{
  "twitch_channels": "<SOME_TWITCH_CHANNEL_NAME>,<SOME_TWITCH_CHANNEL_NAME>",
  "discord_announce_channel": "stream-announcements",
  "discord_mentions": {
    "<SOME_TWITCH_CHANNEL_NAME>": "everyone",
    "<SOME_TWITCH_CHANNEL_NAME>": "here"
  },
  "discord_bot_token": "<SET_ME>",
  "twitch_client_id": "<SET_ME>",
  "twitch_oauth_token": "<SET_ME>",
  "twitch_check_interval_ms": 60000,
  "twitch_use_boxart": true
}

Configuration options explained:

Key Required? Description
twitch_channels โ˜‘ Comma-separated list of all channels you want to monitor and send live notifications for.
discord_announce_channel โ˜‘ Channel name to post stream announcements in. Make sure the bot has permissions to post here.
discord_mentions This maps channel names to the Discord @ you want to send, such as a role or everyone. If a channel is missing here, no @ is used. Note: once the message is updated, the @ is always removed to prevent spamming users with notifications.
discord_bot_token โ˜‘ Your bot token, via Discord developer portal.
twitch_client_id โ˜‘ Client ID for your Twitch app, via developer portal.
twitch_oauth_token โ˜‘ OAuth token that grants access to your Twitch app, via id.twitch.tv as explained above.
twitch_check_interval_ms How often to poll the Twitch API and send or update live embeds.
twitch_use_boxart If true, use alternate Live Embed style that includes game boxart as a thumbnail image if available.

Starting Timbot

Once the application has been configured, start it using node from the installation directory:

node .

Inviting Timbot

Send the following link to the admin of a Discord server to let them invite the Bot:

https://discordapp.com/oauth2/authorize?client_id=BOT_CLIENT_ID&scope=bot

Swap BOT_CLIENT_ID in the URL above for your Discord app's client id, which you can find in the app details.

timbot's People

Contributors

roydejong avatar dependabot[bot] avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.