Skip to content

Rescript bindings for the tmi.js library. With some helpful utilities.

License

Notifications You must be signed in to change notification settings

mxthevs/tmi.res

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tmi.res

ReScript bindings for the tmi.js library. For more info and documentation, checkout the original project here.

⚠️ DISCLAIMER: This library is not complete yet. But it has the basic bindings to get a chatbot up and running.

Install

yarn add tmi.js tmi.res

Add tmi.res to bs-dependencies in your bsconfig.json file:

"bs-dependencies": [
  "tmi.res"
]
open Tmi

let client = createClient(
  makeOptions(
    ~options=Options.make(~debug=true, ~messagesLogLevel=#info, ()),
    ~connection=Connection.make(~reconnect=true, ~secure=true, ()),
    ~identity=Identity.make(~username="bot-name", ~password="oath:my-bot-token"),
    ~channels=["my-channel"],
    (),
  ),
)

client->connect()

let onMessageHandler = (channel, tags, message, self) => {
  if !self && message->Js.String2.toLocaleLowerCase == "!hello" {
    client->say(channel, `@${tags["username"]}, heya!`)
  }
}

client->on(#message(onMessageHandler))

About

Rescript bindings for the tmi.js library. With some helpful utilities.

Resources

License

Stars

Watchers

Forks

Packages

No packages published