Skip to content

TwitchContext

The context of the command.

Extends

  • Base<T>

Type parameters

Type parameterValue
K extends OptionsRecordobject
T extends EventSubConnectionDefaultConnection

Constructors

new TwitchContext()

1
new TwitchContext<K, T>(chatbot: ChatBot<T>, data: MessageData<T, K>): TwitchContext<K, T>

Creates a new instance of the command context.

Parameters

ParameterTypeDescription
chatbotChatBot<T>The current instance of the chatbot.
dataMessageData<T, K>The data of the command.

Returns

TwitchContext<K, T>

Overrides

Base<T>.constructor

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:59

Properties

PropertyModifierTypeDescriptionInherited from
authorreadonlyAuthor<T>The author of the command.-
chatbotreadonlyChatBot<T>The current instance of the chatbot.Base.chatbot
chatroomreadonlyChatRoom<T>The chatroom where the command was run.-
commandNamereadonlystringThe name of the command.-
messagereadonlyMessage<T>The message received when the command was run.-
optionsreadonlyCommandOptionsAux<T, K>The options of the command.-
prefixreadonlystringThe prefix used to run the command.-

Accessors

authorId

1
get authorId(): string

The Id of the author of the command.

Returns

string

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:103


bits

1
get bits(): number

The bits cheered in the context’s message.

Returns

number

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:152


broadcaster

1
get broadcaster(): BaseUser<T>

The context’s broadcaster.

Returns

BaseUser<T>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:124


channel

1
get channel(): BaseChannel<T>

Fetches channel of the context’s chatroom.

Returns

BaseChannel<T>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:159


chatroomId

1
get chatroomId(): string

The Id of the context’s chatroom.

Returns

string

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:117


cheermotes

1
get cheermotes(): Collection<string, BaseCheermote<T>>

The cheermotes of the context’s message.

Returns

Collection<string, BaseCheermote<T>>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:145


content

1
get content(): string

The content of the context’s message. This message is parsed so it will return the message without the prefix and the command name.

Returns

string

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:110


emotes

1
get emotes(): Collection<string, BaseEmote<T, EmoteType>>

The emotes of the context’s message.

Returns

Collection<string, BaseEmote<T, EmoteType>>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:138


mentions

1
get mentions(): Collection<string, BaseUser<T>>

The mentions of the context’s message.

Returns

Collection<string, BaseUser<T>>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:131

Methods

inStream()

1
inStream(): Promise<boolean>

Checks whether the author is a moderator in the context.

Returns

Promise<boolean>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:96


isModerator()

1
isModerator(): Promise<boolean>

Checks whether the bot is moderator in this context.

Returns

Promise<boolean>

A boolean indicating whether the bot is moderator.

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:82


reply()

1
reply(message: string): Promise<BaseMessage<T>>

Replies to the message of the command.

Parameters

ParameterTypeDescription
messagestringThe message to reply.

Returns

Promise<BaseMessage<T>>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:74


stream()

1
stream(): Promise<null | Stream<T>>

Fetches the stream which is currently live in the context. If the stream is offline, it will return null.

Returns

Promise<null | Stream<T>>

Source

twitchfy/packages/chatbot/src/structures/TwitchContext.ts:89