Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/filwiesner/TmiK
Twitch messaging in Kotlin - Simple DSL for interacting with Twitch chat
https://github.com/filwiesner/TmiK
kotlin kotlin-dsl kotlin-js kotlin-jvm multiplatform twitch twitch-irc
Last synced: 26 days ago
JSON representation
Twitch messaging in Kotlin - Simple DSL for interacting with Twitch chat
- Host: GitHub
- URL: https://github.com/filwiesner/TmiK
- Owner: filwiesner
- License: mit
- Created: 2019-06-19T21:16:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-02-08T17:41:40.000Z (almost 4 years ago)
- Last Synced: 2024-09-18T09:48:00.039Z (3 months ago)
- Topics: kotlin, kotlin-dsl, kotlin-js, kotlin-jvm, multiplatform, twitch, twitch-irc
- Language: Kotlin
- Homepage:
- Size: 153 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-twitch-dev - wooodenleg/TmiK - Twitch messaging in Kotlin - Simple DSL for interacting with Twitch chat. (Libraries / Kotlin)
README
# TmiK
[![Download](https://api.bintray.com/packages/wooodenleg/maven/TmiK/images/download.svg?version=latest)](https://bintray.com/wooodenleg/maven/TmiK/_latestVersion)
[![Download](https://api.bintray.com/packages/wooodenleg/maven/TmiK-experimental/images/download.svg?version=latest)](https://bintray.com/wooodenleg/maven/TmiK-experimental/_latestVersion)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/03cd61c9bd1f40a2baf416ae1c84ade6)](https://www.codacy.com/app/wooodenleg/TmiK?utm_source=github.com&utm_medium=referral&utm_content=wooodenleg/TmiK&utm_campaign=Badge_Grade)
[![GitHub](https://img.shields.io/github/license/wooodenleg/TmiK.svg?color=blue)](https://github.com/wooodenleg/TmiK/blob/master/LICENSE)
**T**witch **m**essaging **i**n **K**otlin
Simple DSL for interacting with Twitch chat**See the [Documentation](https://github.com/wooodenleg/TmiK/wiki) for more information**
## State
Only **JVM** and **JS** are targeted but I hope I will be able to add **Native** in the future.
## Example
Example of simple bot
```kotlin
tmi(token) {
+ Reconnect(5) // Tries to reconnect for five times if network fails (and re-joins all channels)channel("MyChannel") {
// Convenient way of listening to commands
commands('!') {
moderators {
"uptime" receive { // on "!uptime" command from moderator
sendMessage("Stream has been running for ${getUptime()} minutes")
}
}
"|h,help|" {
onReceive { // on "!h" or "!help"
// Whisper back to user who sent the command using context
whisper("Psst, ask me about shedule using \"!schedule {day}\"")
}
"schedule {day}" receive { paramaters -> // e.g. "!h schedule monday
val day = paramaters["day"]
sendMessage("Stream starts in ${getShedule(day)} on $day")
}
}
}// Or use just plain old listeners
onMessage {
println("Message from channel $channel received: $text")
}subscribers {
onSubGift {
sendMessage("Awwww, subs giving subs <3")
}
}onRaid {
sendMessage("Hello ${message.sourceDisplayName}! Thanks for the raid!")
}
}onConnected { join("mychannel") }
}
```
## Installation
You can download this library from bintray
```groovy
repositories {
maven { url "https://dl.bintray.com/wooodenleg/maven" }
}dependencies {
implementation "com.tmik:TmiK-jvm:$version" // For JVM
// OR
implementation "com.tmik:TmiK-js:$version" // For JS
}
```