TwitchLib 3.5.3
Loading...
Searching...
No Matches
TwitchLib.Client.Models.MessageEmote Class Reference

Class for maintaining emotes that may be substituted into messages. More...

Public Types

enum  EmoteSource
 Enum supplying the supported sites which provide Emote images. More...
 
enum  EmoteSize
 Enum denoting the emote sizes More...
 

Public Member Functions

delegate string ReplaceEmoteDelegate (MessageEmote caller)
 Delegate allowing Emotes to handle their replacement text on a case-by-case basis. More...
 
 MessageEmote (string id, string text, EmoteSource source=EmoteSource.Twitch, EmoteSize size=EmoteSize.Small, ReplaceEmoteDelegate replacementDelegate=null)
 Constructor for a new MessageEmote instance. More...
 

Static Public Member Functions

static string SourceMatchingReplacementText (MessageEmote caller)
 A delegate which attempts to match the calling MessageEmote with its EmoteSource and pulls the small version of the URL. More...
 

Static Public Attributes

static readonly ReadOnlyCollection< string > TwitchEmoteUrls
 Collection of Composite Format Strings which will substitute an emote ID to get a URL for an image from the Twitch CDN More...
 
static readonly ReadOnlyCollection< string > FrankerFaceZEmoteUrls
 Collection of Composite Format Strings which will substitute an emote ID to get a URL for an image from the FFZ CDN More...
 
static readonly ReadOnlyCollection< string > BetterTwitchTvEmoteUrls
 Collection of Composite Format Strings which will substitute an emote ID to get a URL for an image from the BTTV CDN More...
 

Properties

string Id [get]
 Emote ID as used by the emote source. Will be provided as {0} to be substituted into the indicated URL if needed. More...
 
string Text [get]
 Emote text which appears in a message and is meant to be replaced by the emote image. More...
 
EmoteSource Source [get]
 The specified EmoteSource for this emote. More...
 
EmoteSize Size [get]
 The specified EmoteSize for this emote. More...
 
string ReplacementString [get]
 The string to substitute emote text for. More...
 
static ReplaceEmoteDelegate ReplacementDelegate = SourceMatchingReplacementText [get, set]
 The desired ReplaceEmoteDelegate to use for replacing text in a given emote. Default: SourceMatchingReplacementText(MessageEmote) More...
 
string EscapedText [get]
 The emote text regex-escaped so that it can be embedded into a regex pattern. More...
 

Detailed Description

Class for maintaining emotes that may be substituted into messages.

Also contains helpers to aid in performing actual replacements. Expected to be called from the context of ChatMessage and WhisperMessage.

Member Enumeration Documentation

◆ EmoteSize

Enum denoting the emote sizes

◆ EmoteSource

Enum supplying the supported sites which provide Emote images.

Constructor & Destructor Documentation

◆ MessageEmote()

TwitchLib.Client.Models.MessageEmote.MessageEmote ( string  id,
string  text,
EmoteSource  source = EmoteSource.Twitch,
EmoteSize  size = EmoteSize.Small,
ReplaceEmoteDelegate  replacementDelegate = null 
)

Constructor for a new MessageEmote instance.

Parameters
idThe unique identifier which the emote provider uses to generate CDN URLs.
textThe string which users type to create this emote in chat.
sourceAn EmoteSource where an image can be found for this emote. Default: EmoteSource.Twitch
sizeAn EmoteSize to pull for this image. Default: EmoteSize.Small
replacementDelegateA string (optionally Composite Format with "{0}" representing id ) which will be used instead of any of the emote URLs. Default: null

Member Function Documentation

◆ ReplaceEmoteDelegate()

delegate string TwitchLib.Client.Models.MessageEmote.ReplaceEmoteDelegate ( MessageEmote  caller)

Delegate allowing Emotes to handle their replacement text on a case-by-case basis.

Returns
The string for the calling emote to be replaced with.

◆ SourceMatchingReplacementText()

static string TwitchLib.Client.Models.MessageEmote.SourceMatchingReplacementText ( MessageEmote  caller)
static

A delegate which attempts to match the calling MessageEmote with its EmoteSource and pulls the small version of the URL.

Parameters
caller
Returns

Member Data Documentation

◆ BetterTwitchTvEmoteUrls

readonly ReadOnlyCollection<string> TwitchLib.Client.Models.MessageEmote.BetterTwitchTvEmoteUrls
static
Initial value:
= new ReadOnlyCollection<string>(
new[]
{
"//cdn.betterttv.net/emote/{0}/1x",
"//cdn.betterttv.net/emote/{0}/2x",
"//cdn.betterttv.net/emote/{0}/3x"
}
)

Collection of Composite Format Strings which will substitute an emote ID to get a URL for an image from the BTTV CDN

These are sorted such that the EmoteSize enum can be used as an index, eg BetterTwitchTvEmoteUrls[EmoteSize.Small]

◆ FrankerFaceZEmoteUrls

readonly ReadOnlyCollection<string> TwitchLib.Client.Models.MessageEmote.FrankerFaceZEmoteUrls
static
Initial value:
= new ReadOnlyCollection<string>(
new[]
{
"//cdn.frankerfacez.com/emoticon/{0}/1",
"//cdn.frankerfacez.com/emoticon/{0}/2",
"//cdn.frankerfacez.com/emoticon/{0}/4"
}
)

Collection of Composite Format Strings which will substitute an emote ID to get a URL for an image from the FFZ CDN

These are sorted such that the EmoteSize enum can be used as an index, eg FrankerFaceZEmoteUrls[EmoteSize.Small] WARNING: FrankerFaceZ does not require users to submit all sizes, so using something other than Small images may result in broken links!

◆ TwitchEmoteUrls

readonly ReadOnlyCollection<string> TwitchLib.Client.Models.MessageEmote.TwitchEmoteUrls
static
Initial value:
= new ReadOnlyCollection<string>(
new[]
{
"https://static-cdn.jtvnw.net/emoticons/v1/{0}/1.0",
"https://static-cdn.jtvnw.net/emoticons/v1/{0}/2.0",
"https://static-cdn.jtvnw.net/emoticons/v1/{0}/3.0"
}
)

Collection of Composite Format Strings which will substitute an emote ID to get a URL for an image from the Twitch CDN

These are sorted such that the EmoteSize enum can be used as an index, eg TwitchEmoteUrls[EmoteSize.Small]

Property Documentation

◆ EscapedText

string TwitchLib.Client.Models.MessageEmote.EscapedText
get

The emote text regex-escaped so that it can be embedded into a regex pattern.

◆ Id

string TwitchLib.Client.Models.MessageEmote.Id
get

Emote ID as used by the emote source. Will be provided as {0} to be substituted into the indicated URL if needed.

◆ ReplacementDelegate

ReplaceEmoteDelegate TwitchLib.Client.Models.MessageEmote.ReplacementDelegate = SourceMatchingReplacementText
staticgetset

The desired ReplaceEmoteDelegate to use for replacing text in a given emote. Default: SourceMatchingReplacementText(MessageEmote)

◆ ReplacementString

string TwitchLib.Client.Models.MessageEmote.ReplacementString
get

The string to substitute emote text for.

◆ Size

EmoteSize TwitchLib.Client.Models.MessageEmote.Size
get

The specified EmoteSize for this emote.

◆ Source

EmoteSource TwitchLib.Client.Models.MessageEmote.Source
get

The specified EmoteSource for this emote.

◆ Text

string TwitchLib.Client.Models.MessageEmote.Text
get

Emote text which appears in a message and is meant to be replaced by the emote image.


The documentation for this class was generated from the following file: