Options
All
  • Public
  • Public/Protected
  • All
Menu

dank-twitch-irc

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

AnonGiftPaidUpgradeParameters

AnonGiftPaidUpgradeParameters: EventParams & { promoGiftTotal?: undefined | number; promoGiftTotalRaw?: undefined | string; promoName?: undefined | string }

AnonGiftPaidUpgradeUsernoticeMessage

AnonGiftPaidUpgradeUsernoticeMessage: SpecificUsernoticeMessage<"anongiftpaidupgrade", AnonGiftPaidUpgradeParameters>

AnonSubgiftParameters

AnonSubgiftParameters: SubgiftParameters

AnonSubgiftUsernoticeMessage

AnonSubgiftUsernoticeMessage: SpecificUsernoticeMessage<"anonsubgift", AnonSubgiftParameters>

BasicTcpTransportConfiguration

BasicTcpTransportConfiguration: Omit<TcpTransportConfiguration, "host" | "port">

BitsBadgeTierUsernoticeMessage

BitsBadgeTierUsernoticeMessage: SpecificUsernoticeMessage<"bitsbadgetier", BitsBadgeTierParameters>

ClientEvents

Condition

Condition: (message: IRCMessage) => boolean

Type declaration

ConnectionPredicate

ConnectionPredicate: (conn: SingleConnection) => boolean

Type declaration

CustomRateLimitsConfig

CustomRateLimitsConfig: MessageRateLimits

ExpandedClientConfiguration

ExpandedClientConfiguration: Required<Omit<ClientConfiguration, "connection" | "password" | "rateLimits">> & { connection: ExpandedTransportConfiguration; password: string | undefined; rateLimits: MessageRateLimits }

ExpandedDuplexTransportConfiguration

ExpandedDuplexTransportConfiguration: Required<DuplexTransportConfiguration>

ExpandedTcpTransportConfiguration

ExpandedTcpTransportConfiguration: Required<TcpTransportConfiguration> & { preSetup: false }

ExpandedTransportConfiguration

ExpandedWebSocketTransportConfiguration

ExpandedWebSocketTransportConfiguration: WebSocketTransportConfiguration & { preSetup: false }

FakeClientData

FakeClientData: { client: ChatClient; clientError: Promise<void>; emit: (...lines: string[]) => void; emitAndEnd: (...lines: string[]) => void; end: () => void; transports: MockTransportData[] }

Type declaration

  • client: ChatClient
  • clientError: Promise<void>
  • emit: (...lines: string[]) => void
      • (...lines: string[]): void
      • Parameters

        • Rest ...lines: string[]

        Returns void

  • emitAndEnd: (...lines: string[]) => void
      • (...lines: string[]): void
      • Parameters

        • Rest ...lines: string[]

        Returns void

  • end: () => void
      • (): void
      • Returns void

  • transports: MockTransportData[]

FakeConnectionData

FakeConnectionData: { client: SingleConnection; clientError: Promise<void> } & MockTransportData

FunctionAt

FunctionAt<T, K>: (...args: Parameters<T[K]>) => ReturnType<T[K]>

Type parameters

Type declaration

    • (...args: Parameters<T[K]>): ReturnType<T[K]>
    • Parameters

      • Rest ...args: Parameters<T[K]>

      Returns ReturnType<T[K]>

FunctionKeysOf

FunctionKeysOf<T>: SelectKeys<T, (...args: any) => any>

Type parameters

  • T: object

GiftPaidUpgradeParameters

GiftPaidUpgradeParameters: AnonGiftPaidUpgradeParameters & { senderLogin: string; senderName: string }

GiftPaidUpgradeUsernoticeMessage

GiftPaidUpgradeUsernoticeMessage: SpecificUsernoticeMessage<"giftpaidupgrade", GiftPaidUpgradeParameters>

MockTransportData

MockTransportData: { data: any[]; emit: (...lines: string[]) => void; emitAndEnd: (...lines: string[]) => void; end: (error?: Error) => void; transport: Duplex }

Type declaration

  • data: any[]
  • emit: (...lines: string[]) => void
      • (...lines: string[]): void
      • Parameters

        • Rest ...lines: string[]

        Returns void

  • emitAndEnd: (...lines: string[]) => void
      • (...lines: string[]): void
      • Parameters

        • Rest ...lines: string[]

        Returns void

  • end: (error?: Error) => void
      • (error?: Error): void
      • Parameters

        • Optional error: Error

        Returns void

  • transport: Duplex

OverrideFunction

OverrideFunction<S, T, K>: (this: S, oldFn: FunctionAt<T, K>, ...args: Parameters<T[K]>) => ReturnType<T[K]>

Type parameters

Type declaration

    • (this: S, oldFn: FunctionAt<T, K>, ...args: Parameters<T[K]>): ReturnType<T[K]>
    • Parameters

      • this: S
      • oldFn: FunctionAt<T, K>
      • Rest ...args: Parameters<T[K]>

      Returns ReturnType<T[K]>

OverrideFunctions

OverrideFunctions<S, T>: {}

Type parameters

  • S

  • T: object

Type declaration

PresetKeys

PresetKeys: "default" | "knownBot" | "verifiedBot"

PrivmsgUserState

PrivmsgUserState: Omit<UserState, "emoteSets" | "emoteSetsRaw">

Omits emoteSets and emoteSetsRaw from UserState (because they are not sent for PRIVMSG messages)

RaidUsernoticeMessage

RaidUsernoticeMessage: SpecificUsernoticeMessage<"raid", RaidParams>

RateLimitsConfig

ResubUsernoticeMessage

ResubUsernoticeMessage: SpecificUsernoticeMessage<"resub", SubEventParams>

RitualUsernoticeMessage

RitualUsernoticeMessage: SpecificUsernoticeMessage<"ritual", RitualParameters>

SelectKeys

SelectKeys<O, M>: {}[keyof O]

Type parameters

  • O: object

  • M: any

StreakSubParams

SubEventParams

SubEventParams: EventParams & StreakSubParams & { cumulativeMonths: number; cumulativeMonthsRaw: string; subPlan: string; subPlanName: string }

SubUsernoticeMessage

SubUsernoticeMessage: SpecificUsernoticeMessage<"sub", SubEventParams>

SubgiftUsernoticeMessage

SubgiftUsernoticeMessage: SpecificUsernoticeMessage<"subgift", SubgiftParameters>

TransportConfiguration

TwitchCommands

TwitchCommands: typeof commandClassMap

TwitchEmoteList

TwitchEmoteList: TwitchEmote[]

TwitchEmoteSets

TwitchEmoteSets: string[]

TwitchFlagList

TwitchFlagList: TwitchFlag[]

TwitchMessageEvents

TwitchMessageEvents: {}

Type declaration

Variables

Const MAX_OUTGOING_COMMAND_LENGTH

MAX_OUTGOING_COMMAND_LENGTH: number = MAX_OUTGOING_LINE_LENGTH - 2

Maximum command length (excluding CR LF) the twitch server will accept before chopping the rest off

Const MAX_OUTGOING_LINE_LENGTH

MAX_OUTGOING_LINE_LENGTH: 4096 = 4096

Maximum line length (including CR LF) the twitch server will accept before chopping the rest off

Const VALID_CMD_REGEX

VALID_CMD_REGEX: RegExp = /^(?:[a-zA-Z]+|[0-9]{3})$/

Const actionRegex

actionRegex: RegExp = /^\u0001ACTION (.*)\u0001$/

Const anonymousUsernameRegex

anonymousUsernameRegex: RegExp = /^justinfan\d+$/

Const badNoticeIDs

badNoticeIDs: string[] = ["whisper_banned", // You have been banned from sending whispers."whisper_banned_recipient", // That user has been banned from receiving whispers."whisper_invalid_args", // Usage: <login> <message>"whisper_invalid_login", // No user matching that login."whisper_invalid_self", // You cannot whisper to yourself."whisper_limit_per_min", // You are sending whispers too fast. Try again in a minute."whisper_limit_per_sec", // You are sending whispers too fast. Try again in a second."whisper_restricted", // Your settings prevent you from sending this whisper."whisper_restricted_recipient", // That user's settings prevent them from receiving this whisper.]

camelCase

camelCase: camelCase

Const channelNameRegex

channelNameRegex: RegExp = /^[a-z0-9_]{1,25}$/

Const commandClassMap

commandClassMap: { CAP: typeof CapMessage; CLEARCHAT: typeof ClearchatMessage; CLEARMSG: typeof ClearmsgMessage; GLOBALUSERSTATE: typeof GlobaluserstateMessage; HOSTTARGET: typeof HosttargetMessage; JOIN: typeof JoinMessage; NOTICE: typeof NoticeMessage; PART: typeof PartMessage; PING: typeof PingMessage; PONG: typeof PongMessage; PRIVMSG: typeof PrivmsgMessage; RECONNECT: typeof ReconnectMessage; ROOMSTATE: typeof RoomstateMessage; USERNOTICE: typeof UsernoticeMessage; USERSTATE: typeof UserstateMessage; WHISPER: typeof WhisperMessage } = {CLEARCHAT: ClearchatMessage,CLEARMSG: ClearmsgMessage,GLOBALUSERSTATE: GlobaluserstateMessage,HOSTTARGET: HosttargetMessage,NOTICE: NoticeMessage,PRIVMSG: PrivmsgMessage,ROOMSTATE: RoomstateMessage,USERNOTICE: UsernoticeMessage,USERSTATE: UserstateMessage,WHISPER: WhisperMessage,JOIN: JoinMessage,PART: PartMessage,RECONNECT: ReconnectMessage,PING: PingMessage,PONG: PongMessage,CAP: CapMessage,} as const

Type declaration

  • [key: string]: typeof IRCMessage
  • CAP: typeof CapMessage
  • CLEARCHAT: typeof ClearchatMessage
  • CLEARMSG: typeof ClearmsgMessage
  • GLOBALUSERSTATE: typeof GlobaluserstateMessage
  • HOSTTARGET: typeof HosttargetMessage
  • JOIN: typeof JoinMessage
  • NOTICE: typeof NoticeMessage
  • PART: typeof PartMessage
  • PING: typeof PingMessage
  • PONG: typeof PongMessage
  • PRIVMSG: typeof PrivmsgMessage
  • RECONNECT: typeof ReconnectMessage
  • ROOMSTATE: typeof RoomstateMessage
  • USERNOTICE: typeof UsernoticeMessage
  • USERSTATE: typeof UserstateMessage
  • WHISPER: typeof WhisperMessage

Let connectionIDCounter

connectionIDCounter: number = 0

Const decodeLookupRegex

decodeLookupRegex: RegExp = /\\\\|\\:|\\s|\\n|\\r|\\/g

Const failureNoticeIDs

failureNoticeIDs: string[] = ["no_permission","bad_ban_admin","bad_ban_anon","bad_ban_broadcaster","bad_ban_global_mod","bad_ban_mod","bad_ban_self","bad_ban_staff","usage_ban",]

Const invisibleSuffix

invisibleSuffix: " ó €€" = " ó €€"

Const log

log: Logger = debugLogger("dank-twitch-irc:client")

ms

ms: ms

pickBy

pickBy: pickBy

Const rgbColorRegex

rgbColorRegex: RegExp = /^#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/

Const successNoticeIDs

successNoticeIDs: string[] = ["ban_success", "already_banned"]

Functions

acknowledgesCapabilities

  • acknowledgesCapabilities(requestedCapabilities: string[]): Condition

Const alwaysFalse

  • alwaysFalse(): false

Const alwaysTrue

  • alwaysTrue(): true
  • alwaysTrue(): true

anyCauseInstanceof

  • anyCauseInstanceof(error: Error | undefined, constructor: any): boolean

applyReplacement

  • applyReplacement<S, T, K>(self: S, target: T, key: K, newFn: OverrideFunction<S, T, K>): void

applyReplacements

  • applyReplacements<S, T>(self: S, target: T, replacements: OverrideFunctions<S, T>): void

assertErrorChain

  • assertErrorChain(p: Promise<any> | Promise<any>[], ...chain: any[]): Promise<void>
  • assertErrorChain(e: Error | undefined, ...chain: any[]): void
  • Parameters

    • p: Promise<any> | Promise<any>[]
    • Rest ...chain: any[]

    Returns Promise<void>

  • Parameters

    • e: Error | undefined
    • Rest ...chain: any[]

    Returns void

assertLink

  • assertLink(e: Error, chain: any[], depth?: number): void
  • Parameters

    • e: Error
    • chain: any[]
    • Default value depth: number = 0

    Returns void

assertThrowsChain

  • assertThrowsChain(f: () => void, ...chain: any[]): void
  • Parameters

    • f: () => void
        • (): void
        • Returns void

    • Rest ...chain: any[]

    Returns void

awaitJoinResponse

awaitPartResponse

awaitResponse

ban

  • ban(conn: SingleConnection, channelName: string, username: string, reason?: undefined | string): Promise<void>

canSpamFast

causeOf

  • causeOf(error: Error): Error | undefined

colorToHexString

  • colorToHexString(color: Color): string
  • Make a hexadecimal color string (like e.g. #AABBCC) from a given color object.

    Parameters

    Returns string

convertToBadges

convertToBoolean

  • convertToBoolean(value: string): boolean

convertToColor

  • convertToColor(value: string): Color | undefined

convertToEmoteSets

convertToEmotes

convertToFlags

convertToInt

  • convertToInt(value: string): number

convertToString

  • convertToString(value: string): string

convertToTimestamp

  • convertToTimestamp(value: string): Date

correctChannelName

  • correctChannelName(input: string): string

createMockTransport

decodeValue

  • decodeValue(value: string | undefined): string | null

deniedAnyCapability

  • deniedAnyCapability(requestedCapabilities: string[]): Condition

errorOf

  • errorOf(p: Promise<any>): Promise<any>

expandConfig

expandRateLimitsConfig

expandTransportConfig

extractEventParams

fakeClient

fakeConnection

findAndPushToEnd

  • findAndPushToEnd<T>(arr: T[], filter: (t: T) => boolean): T | undefined
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • filter: (t: T) => boolean
        • (t: T): boolean
        • Parameters

          • t: T

          Returns boolean

    Returns T | undefined

findByPredicate

  • findByPredicate<T>(arr: T[], filter: (t: T) => boolean): { index: number; value: T } | undefined
  • Type parameters

    • T

    Parameters

    • arr: T[]
    • filter: (t: T) => boolean
        • (t: T): boolean
        • Parameters

          • t: T

          Returns boolean

    Returns { index: number; value: T } | undefined

getCamelCasedName

  • getCamelCasedName(tagKey: string): string

getData

  • getData<V, A>(ircTags: IRCMessageTags, key: string, converter: (value: string, ...converterArgs: A) => V, ...converterArgs: A): V | undefined
  • Type parameters

    • V

    • A: any[]

    Parameters

    • ircTags: IRCMessageTags
    • key: string
    • converter: (value: string, ...converterArgs: A) => V
        • (value: string, ...converterArgs: A): V
        • Parameters

          • value: string
          • Rest ...converterArgs: A

          Returns V

    • Rest ...converterArgs: A

    Returns V | undefined

getIRCChannelName

  • getIRCChannelName(message: Pick<IRCMessage, "ircParameters">, optional?: undefined | false): string
  • getIRCChannelName(message: Pick<IRCMessage, "ircParameters">, optional: true): string | undefined

getMods

getModsOrVips

getParameter

  • getParameter(message: Pick<IRCMessage, "ircParameters">, idx: number): string

getVips

handleReconnectMessage

hasAllStateTags

  • hasAllStateTags(partialRoomState: Partial<RoomState>): partialRoomState is RoomState

Const ignoreErrors

  • ignoreErrors(): undefined

isAnonymousUsername

  • isAnonymousUsername(username: string): boolean

joinAll

  • joinAll(conn: SingleConnection, channelNames: string[]): Promise<Record<string, Error | undefined>>

joinChannel

joinNothingToDo

makeTransport

matchingNotice

  • matchingNotice(channelName: string, noticeIDs: string[]): (msg: IRCMessage) => boolean

maxJoinedChannels

me

mustNotBeJoined

parseActionAndMessage

  • parseActionAndMessage(trailingParameter: string): { isAction: boolean; message: string }

parseBadges

parseColor

  • parseColor(colorSrc: string): Color

parseEmoteSets

parseEmotes

parseFlags

parseHostedChannelName

  • parseHostedChannelName(rawHostedChannelName: string | undefined): string | undefined

parseHosttargetParameter

  • parseHosttargetParameter(rawParameter: string): { hostedChannelName: string | undefined; viewerCount: number | undefined }
  • Parameters

    • rawParameter: string

    Returns { hostedChannelName: string | undefined; viewerCount: number | undefined }

    • hostedChannelName: string | undefined
    • viewerCount: number | undefined

parseIRCMessage

parseIntThrowing

  • parseIntThrowing(str: string | null | undefined): number

parseSingleBadge

parseTags

parseTwitchMessage

  • parseTwitchMessage(messageSrc: string): IRCMessage

parseViewerCount

  • parseViewerCount(rawViewerCount: string | undefined): number | undefined

partChannel

partNothingToDo

randomPingIdentifier

  • randomPingIdentifier(): string

reasonForValue

  • reasonForValue(actualValue: string | null | undefined): string

removeCommands

  • removeCommands(message: string): string

removeInPlace

  • removeInPlace<T>(arr: T[], element: T): void

replyToServerPing

requestCapabilities

  • requestCapabilities(conn: SingleConnection, requestMembershipCapability: boolean): Promise<void>

requireData

  • requireData<V, A>(ircTags: IRCMessageTags, key: string, converter: (value: string, ...converterArgs: A) => V | undefined, ...converterArgs: A): V
  • Type parameters

    • V

    • A: any[]

    Parameters

    • ircTags: IRCMessageTags
    • key: string
    • converter: (value: string, ...converterArgs: A) => V | undefined
        • (value: string, ...converterArgs: A): V | undefined
        • Parameters

          • value: string
          • Rest ...converterArgs: A

          Returns V | undefined

    • Rest ...converterArgs: A

    Returns V

requireNickname

  • requireNickname(message: Pick<IRCMessage, "ircPrefix">): string

requireParameter

  • requireParameter(message: Pick<IRCMessage, "ircParameters">, idx: number): string

say

sendClientPings

sendLogin

  • sendLogin(conn: SingleConnection, username: string, password?: undefined | string): Promise<void>

sendPing

sendPrivmsg

  • sendPrivmsg(conn: SingleConnection, channelName: string, message: string): Promise<void>

setColor

setDefaults

  • setDefaults<I, D>(input: I | undefined, defaults: D): I & D

splitIntoChunks

  • splitIntoChunks(bits: string[], separator?: string, limit: number): string[][]

successResponsesForChannelChunk

  • successResponsesForChannelChunk(channels: string[]): string[]

tagParserFor

timeout

  • timeout(conn: SingleConnection, channelName: string, username: string, length: number, reason?: undefined | string): Promise<void>

toPaddedHex

  • toPaddedHex(i: number, shouldBeLength: number): string

unionSets

  • unionSets<T>(sets: Set<T>[]): Set<T>

validateChannelName

  • validateChannelName(input?: string | null): void

validateIRCCommand

  • validateIRCCommand(command: string): void

whisper

  • whisper(conn: SingleConnection, username: string, message: string): Promise<void>

Object literals

Const configDefaults

configDefaults: object

failure

failure: Condition = alwaysFalse

interval

interval: number = 60 * 1000

noResponseAction

noResponseAction: string = "failure"

success

success: Condition = alwaysFalse

timeout

timeout: number = 2000

Const convertersMap

convertersMap: object

msg-param-cumulative-months

msg-param-cumulative-months: convertToInt = convertToInt

msg-param-gift-months

msg-param-gift-months: convertToInt = convertToInt

msg-param-months

msg-param-months: convertToInt = convertToInt

msg-param-promo-gift-total

msg-param-promo-gift-total: convertToInt = convertToInt

msg-param-sender-count

msg-param-sender-count: convertToInt = convertToInt

msg-param-should-share-streak

msg-param-should-share-streak: convertToBoolean = convertToBoolean

msg-param-streak-months

msg-param-streak-months: convertToInt = convertToInt

msg-param-threshold

msg-param-threshold: convertToInt = convertToInt

msg-param-viewerCount

msg-param-viewerCount: convertToInt = convertToInt

Const decodeMap

decodeMap: object

\

\: string = ""

\:

\:: string = ";"

\\

\\: string = "\"

\n

\n: string = ""

\r

\r: string = " "

\s

\s: string = " "

Const defaults

defaults: object

ignoreUnhandledPromiseRejections

ignoreUnhandledPromiseRejections: false = false

installDefaultMixins

installDefaultMixins: true = true

maxChannelCountPerConnection

maxChannelCountPerConnection: number = 90

password

password: undefined = undefined

requestMembershipCapability

requestMembershipCapability: false = false

username

username: string = "justinfan12345"

connection

connection: object

secure

secure: true = true

type

type: "tcp" = "tcp"

connectionRateLimits

connectionRateLimits: object

parallelConnections

parallelConnections: number = 1

releaseTime

releaseTime: number = 2000

Const getModsInfo

getModsInfo: object

command

command: "mods" = "mods"

msgIdError

msgIdError: string = "usage_mods"

msgIdNone

msgIdNone: string = "no_mods"

msgIdSome

msgIdSome: string = "room_mods"

someMessagePrefix

someMessagePrefix: string = "The moderators of this channel are: "

someMessageSuffix

someMessageSuffix: string = ""

Const getVipsInfo

getVipsInfo: object

command

command: "vips" = "vips"

msgIdError

msgIdError: string = "usage_vips"

msgIdNone

msgIdNone: string = "no_vips"

msgIdSome

msgIdSome: string = "vips_success"

someMessagePrefix

someMessagePrefix: string = "The VIPs of this channel are: "

someMessageSuffix

someMessageSuffix: string = "."

Const messageRateLimitPresets

messageRateLimitPresets: object

default

default: object

highPrivmsgLimits

highPrivmsgLimits: number = 100

lowPrivmsgLimits

lowPrivmsgLimits: number = 20

knownBot

knownBot: object

highPrivmsgLimits

highPrivmsgLimits: number = 100

lowPrivmsgLimits

lowPrivmsgLimits: number = 50

verifiedBot

verifiedBot: object

highPrivmsgLimits

highPrivmsgLimits: number = 7500

lowPrivmsgLimits

lowPrivmsgLimits: number = 7500

Generated using TypeDoc