TwitchContext
The context of the command.
Extends
Base<T>
Type parameters
| Type parameter | Value |
|---|---|
K extends OptionsRecord | object |
T extends EventSubConnection | DefaultConnection |
Constructors
new TwitchContext()
1new TwitchContext<K, T>(chatbot: ChatBot<T>, data: MessageData<T, K>): TwitchContext<K, T>Creates a new instance of the command context.
Parameters
| Parameter | Type | Description |
|---|---|---|
chatbot | ChatBot<T> | The current instance of the chatbot. |
data | MessageData<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
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
author | readonly | Author<T> | The author of the command. | - |
chatbot | readonly | ChatBot<T> | The current instance of the chatbot. | Base.chatbot |
chatroom | readonly | ChatRoom<T> | The chatroom where the command was run. | - |
commandName | readonly | string | The name of the command. | - |
message | readonly | Message<T> | The message received when the command was run. | - |
options | readonly | CommandOptionsAux<T, K> | The options of the command. | - |
prefix | readonly | string | The prefix used to run the command. | - |
Accessors
authorId
1get authorId(): stringThe Id of the author of the command.
Returns
string
Source
twitchfy/packages/chatbot/src/structures/TwitchContext.ts:103
bits
1get bits(): numberThe bits cheered in the context’s message.
Returns
number
Source
twitchfy/packages/chatbot/src/structures/TwitchContext.ts:152
broadcaster
1get broadcaster(): BaseUser<T>The context’s broadcaster.
Returns
BaseUser<T>
Source
twitchfy/packages/chatbot/src/structures/TwitchContext.ts:124
channel
1get channel(): BaseChannel<T>Fetches channel of the context’s chatroom.
Returns
BaseChannel<T>
Source
twitchfy/packages/chatbot/src/structures/TwitchContext.ts:159
chatroomId
1get chatroomId(): stringThe Id of the context’s chatroom.
Returns
string
Source
twitchfy/packages/chatbot/src/structures/TwitchContext.ts:117
cheermotes
1get 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
1get content(): stringThe 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
1get 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
1get 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()
1inStream(): 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()
1isModerator(): 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()
1reply(message: string): Promise<BaseMessage<T>>Replies to the message of the command.
Parameters
| Parameter | Type | Description |
|---|---|---|
message | string | The message to reply. |
Returns
Promise<BaseMessage<T>>
Source
twitchfy/packages/chatbot/src/structures/TwitchContext.ts:74
stream()
1stream(): 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