Documentation ¶
Index ¶
Constants ¶
View Source
const ( TWITCH_NICK = "justinfan28165" TWITCH_WS_URL = "irc-ws.chat.twitch.tv" PASS = "SCHMOOPIIE" USER_TYPE_SEPERATOR = "PRIVMSG #" )
Variables ¶
View Source
var ( // https://ircv3.net/specs/extensions/message-tags.html IRC_MSG_TAGS = []string{"subscriber", "user-id", "user-type", "mod", "tmi-sent-ts", "display-name", "reply-parent-msg-body", "reply-parent-user-login", "system-msg", "msg-param-recipient-user-name", "msg-param-recipient-display-name", "msg-param-gift-months", "msg-param-months", "msg-id"} )
Functions ¶
func FetchMessages ¶
func InitializeConnection ¶
Opens a websocket connection to twitch chat Call this function again to reconnect
Types ¶
type Message ¶
type Message struct { // Username of user sending message Username string // Actual chat message Message string // if the user is subscriber or not Subscriber string // id of user sending message UserId string // timestamp in milliseconds Timestamp string // message to which this message is a reply ReplyTo string // username of user to whom this message is a reply ReplyToUser string // if the user is mod or not Mod string // System messages are messages by twitch // These include gifted subs and other actions SystemMsg string // Recipient of sub gift or other action MsgParamRecipientUsername string // Recipient display name MsgParamRecipientDisplayName string // Number of months of gifted sub MsgParamGiftMonths string // Number of months MsgParamMonths string // msg-id=subgift means gifted sub MsgId string }
func ParseTags ¶
Parse twitch IRC tags and return a `Message` Example of IRC tags in new ws message-
@badge-info=;badges=;client-nonce=3b6178753cbb5d5654e546105f1b3714;color=#009EC3; display-name=killertrip7;emotes=;first-msg=0;flags=;id=ec1296ae-c5f2-4eec-bf88-74b0088689fb;mod=0; room-id=26490481;subscriber=0;tmi-sent-ts=1641025567523;turbo=0;user-id=64035912; user-type= :killertrip7!killertrip7@killertrip7.tmi.twitch.tv PRIVMSG #summit1g :!p wing
Click to show internal directories.
Click to hide internal directories.