Skip to main content
The Deno 2 Release Candidate is here
Learn more

banner workflow_codeql workflow_deno
THE Twitch Extension for your Deno-based Harmony Discord Bot

  • Notifies you if your favorite streamers go live

Usage

In order to use this extension it is crucial to create a .env file in the root directory of your Harmony bot. Within that file you need to include your client id and auth token you got from Twitch:

TWITCH_CLIENT_ID=
TWITCH_AUTH_TOKEN=

Example

A minimal example of using this extension:

import { CommandClient, Intents } from 'https://deno.land/x/harmony/mod.ts'
import { TwitchExtension } from 'https://deno.land/x/twitch-harmony/mod.ts'

const client = new CommandClient({
  prefix: '!'
})

// load the extension
client.extensions.load(new TwitchExtension(client, "NOTIFICATION_CHANNEL"))

client.on('ready', () => {
  console.log(`Ready! User: ${client.user?.tag}`)
})

client.connect('mysecrettoken123', Intents.GuildMembers)

When loading the extensions you should instantiate the extension class with a second parameter, which is the notification channel. This channel is used by the bot to inform you, when a watched streamer goes live.

Testing

The code is 100% covered!
Tests are automatically run on push or pull request to main by GitHub actions.

How does it work?

You can read through the wiki page if you are interested in that.