Comparing version 1.1.3 to 1.2.0
@@ -136,2 +136,7 @@ 'use strict' | ||
if (data.includes('CLEARMSG')) { | ||
const event = utils.formatCLEARMSG(data); | ||
this.emit('messagedeletion'); | ||
} | ||
if (data.includes(`@${this.username}.tmi.twitch.tv JOIN`)) { | ||
@@ -138,0 +143,0 @@ const channel = utils.formatJOIN(data).split(':')[0]; |
@@ -79,2 +79,23 @@ module.exports = { | ||
formatCLEARMSG(event) { | ||
const parsed = {}; | ||
const msg_parts = event.split('CLEARMSG'); | ||
let split_msg_parts = msg_parts[0].split(';'); | ||
let username = split_msg_parts[0].split('@login=')[1]; | ||
let roomId = split_msg_parts[1].split('@room-id=')[1]; | ||
let msgId = split_msg_parts[2].split('target-msg-id=')[1]; | ||
let tmi = split_msg_parts[3].split(' ')[0].split('tmi-sent-ts='); | ||
let channel = msg_parts[1].split("#")[1].split(" :")[0]; | ||
let msg = msg_parts[1].split("#")[1].split(" :")[1]; | ||
parsed['type'] = "delete"; | ||
parsed['target_username'] = username; | ||
parsed['channel'] = channel; | ||
parsed['room_id'] = roomId; | ||
parsed['tmi_sent_ts'] = tmi; | ||
parsed['msg_id'] = msgId; | ||
}, | ||
formatTAGS(tagstring) { | ||
@@ -81,0 +102,0 @@ let tagObject = {} |
{ | ||
"name": "twitch-kit", | ||
"version": "1.1.3", | ||
"version": "1.2.0", | ||
"description": "Twitch Bot Package with amazing features like Title Update.", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
}, | ||
"author": "Robin Klein", | ||
"author": "Robin Klein, Leon Enneken", | ||
"license": "MIT", | ||
@@ -18,3 +18,4 @@ "keywords": [ | ||
"twitch-api", | ||
"twitch.tv" | ||
"twitch.tv", | ||
"twitchkit" | ||
], | ||
@@ -21,0 +22,0 @@ "homepage": "https://robin.software", |
262
README.md
@@ -175,6 +175,268 @@ # Twitch Kit | ||
}) | ||
/** | ||
NEW | ||
This Event will be called if a Message gets Deleted in the Chat. | ||
The Event will look like this: | ||
{ | ||
type: "delete", | ||
target_username: "shortbyte", | ||
channel: "dieserobin", | ||
room_id: "144258400" // May be Empty because Twitch does not send this Information all the times., | ||
tmi_sent_ts: "1594848674269", | ||
msg_id: "MSG ID" | ||
} | ||
*/ | ||
Bot.on('messagedeletion', (event) => { | ||
Bot.say(`The Message "${event.msg_id} from ${event.target_username} was deleted."`); | ||
}); | ||
``` | ||
# Docs | ||
## Events | ||
## join | ||
This Event will be called when the Bot connects to a Twitch Chat. | ||
The Channel String will look like this: | ||
#dieserobin | ||
### message | ||
This Event will be called if a Message is sent into the Chat. | ||
The Chatter Object will look like this: | ||
``` | ||
{ | ||
badge_info: null, | ||
badges: { broadcaster: 1, 'glhf-pledge': 1 }, | ||
client_nonce: 'b48dcd7b5a3bb765b7c86fe64b797b15', | ||
color: '#FF0000', | ||
display_name: 'dieserobin', | ||
emotes: null, | ||
flags: null, | ||
id: '2d8a3377-4d03-4796-aef5-82c7dbf40a76', | ||
mod: true, | ||
room_id: 144258400, | ||
subscriber: false, | ||
tmi_sent_ts: 1594847963605, | ||
turbo: false, | ||
user_id: 144258400, | ||
user_type: null, | ||
channel: '#dieserobin', | ||
message: '123', | ||
username: 'dieserobin' | ||
} | ||
``` | ||
NOTE: A user counts as Moderator if he is Broadcaster. | ||
### timeout | ||
This Event will be called if an User gets an timeout in the Chat. | ||
The Event Object look like this: | ||
``` | ||
{ | ||
ban_duration: 60, | ||
room_id: 144258400, | ||
target_user_id: 187990039, | ||
tmi_sent_ts: 1594848491208, | ||
type: 'timeout', | ||
channel: '#dieserobin', | ||
target_username: 'mrscalo' | ||
} | ||
``` | ||
### ban | ||
This Event will be called if an User gets an Ban in the Chat. | ||
The Event Object look like this: | ||
``` | ||
{ | ||
room_id: 144258400, | ||
target_user_id: 187990039, | ||
tmi_sent_ts: 1594848674269, | ||
type: 'ban', | ||
channel: '#dieserobin', | ||
target_username: 'mrscalo' | ||
} | ||
``` | ||
### error | ||
This Event is only for Development purposes and shows you every Response the Twitch Server sends, you don't need to use. | ||
### ircdata | ||
This Event is only for Development purposes and shows you every Response the Twitch Server sends, you don't need to use this. | ||
### messagedeletion | ||
NEW | ||
``` | ||
This Event will be called if a Message gets Deleted in the Chat. | ||
The Event will look like this: | ||
{ | ||
type: "delete", | ||
target_username: "shortbyte", | ||
channel: "dieserobin", | ||
room_id: "144258400" // May be Empty because Twitch does not send this Information all the times., | ||
tmi_sent_ts: "1594848674269", | ||
msg_id: "MSG ID" | ||
} | ||
``` | ||
## Functions | ||
### say | ||
Send Message to Channel | ||
Parameters: | ||
- Message: String (>= 500) | ||
- Channel Name: String | ||
### timeout | ||
Timeout a specific User in Channel | ||
Parameters: | ||
- Username: String | ||
- Duration: String | ||
- Reason: String | ||
- Channel Name: String | ||
### ban | ||
Ban a specific User in a Channel | ||
Parameters: | ||
- Username: String | ||
- Reason: String | ||
- Channel Name: String | ||
### removeTimeout | ||
Untimeout a specific User in a Channel | ||
Parameters: | ||
- Username: String | ||
- Channel Name: String | ||
### removeBan | ||
Unban a specific User in a Channel | ||
Parameters: | ||
- Username: String | ||
- Channel Name: String | ||
### followerChat | ||
Set Chat to Only Follower Chat | ||
Parameters: | ||
- State: Boolean | ||
- Channel Name: String | ||
- Duration <OPTIONAL>: Number | ||
### subscriberChat | ||
Set Chat to Only Subscriber Chat | ||
Parameters: | ||
- State: Boolean | ||
- Channel Name: String | ||
### uniqueChat | ||
Set Chat to Unique Mode | ||
Parameters: | ||
- State: Boolean | ||
- Channel Name: String | ||
### slowChat | ||
Set Chat in Slow Mode | ||
Parameters: | ||
- State: Boolean | ||
- Channel Name: String | ||
- Delay: Number | ||
### clearChat | ||
Clear the Chat | ||
Parameters: | ||
- Channel Name: String | ||
### setMod | ||
Add a new Mod to Channel (Requires Broadcaster) | ||
Parameters: | ||
- Username: String | ||
- Channel Name: String | ||
### removeMod | ||
Remove a Mod from Channel (Requires Broadcaster) | ||
Parameters: | ||
- Username: String | ||
- Channel Name: String | ||
### setVIP | ||
Add a new VIP to Channel (Requires Broadcaster) | ||
Parameters: | ||
- Username: String | ||
- Channel Name: String | ||
### removeVIP | ||
Remove a VIP from Channel (Requires Broadcaster) | ||
Parameters: | ||
- Username: String | ||
- Channel Name: String | ||
### setColor | ||
Set Color of Bot | ||
Parameters: | ||
- Color: String | ||
### updateTitle | ||
Update Stream Title (Requires Editor) | ||
Parameters: | ||
- Title: String | ||
- Channel Name: String | ||
### updateGame | ||
Update Stream Game (Requires Editor) | ||
Parameters: | ||
- Game: String | ||
- Channel Name: String | ||
### getChannel | ||
Get Channel Information | ||
Parameters: | ||
- Channel Name: String | ||
# License | ||
@@ -181,0 +443,0 @@ This Project is licensed under the MIT License, read more in the [License](LICENSE) file. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32768
675
445