Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move all emote & cheermote parsing logic out of common package
- Loading branch information
Showing
19 changed files
with
196 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* The type of background a cheermote is supposed to appear on. | ||
* | ||
* We will supply a fitting graphic that does not show any artifacts | ||
* on the given type of background. | ||
*/ | ||
export type CheermoteBackground = 'dark' | 'light'; | ||
|
||
/** | ||
* The state of a cheermote, i.e. whether it's animated or not. | ||
*/ | ||
export type CheermoteState = 'animated' | 'static'; | ||
|
||
/** | ||
* The scale of the cheermote, which usually relates to the pixel density of the device in use. | ||
*/ | ||
export type CheermoteScale = '1' | '1.5' | '2' | '3' | '4'; | ||
|
||
/** | ||
* The format of the cheermote you want to request. | ||
*/ | ||
export interface CheermoteFormat { | ||
/** | ||
* The desired background for the cheermote. | ||
*/ | ||
background: CheermoteBackground; | ||
|
||
/** | ||
* The desired cheermote state. | ||
*/ | ||
state: CheermoteState; | ||
|
||
/** | ||
* The desired cheermote scale. | ||
*/ | ||
scale: CheermoteScale; | ||
} | ||
|
||
/** | ||
* The details on how a cheermote should be displayed. | ||
*/ | ||
export interface CheermoteDisplayInfo { | ||
/** | ||
* The URL of the image that should be shown. | ||
*/ | ||
url: string; | ||
|
||
/** | ||
* The color that should be used to show the cheer amount. | ||
* | ||
* This is a hexadecimal color value, e.g. `#9c3ee8`. | ||
*/ | ||
color: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/** | ||
* A part of a parsed message that represents plain text. | ||
*/ | ||
export interface ParsedMessageTextPart { | ||
/** | ||
* The type of the message part. This is text. | ||
*/ | ||
type: 'text'; | ||
|
||
/** | ||
* The starting position of the text in the message, zero based. | ||
*/ | ||
position: number; | ||
|
||
/** | ||
* The length of the text in the message. | ||
*/ | ||
length: number; | ||
|
||
/** | ||
* The text. | ||
*/ | ||
text: string; | ||
} | ||
|
||
/** | ||
* A part of a parsed message that represents a cheermote. | ||
*/ | ||
export interface ParsedMessageCheerPart { | ||
/** | ||
* The type of the message part. This is a cheermote. | ||
*/ | ||
type: 'cheer'; | ||
|
||
/** | ||
* The name of the cheermote. | ||
*/ | ||
name: string; | ||
|
||
/** | ||
* The amount of bits for the cheermote. | ||
*/ | ||
amount: number; | ||
|
||
/** | ||
* The starting position of the cheermote in the message, zero based. | ||
*/ | ||
position: number; | ||
|
||
/** | ||
* The length of the cheermote in the message. | ||
*/ | ||
length: number; | ||
} | ||
|
||
/** | ||
* A part of a parsed message that represents an emote. | ||
*/ | ||
export interface ParsedMessageEmotePart { | ||
/** | ||
* The type of the message part. This is an emote. | ||
*/ | ||
type: 'emote'; | ||
|
||
/** | ||
* The starting position of the emote in the message, zero based. | ||
*/ | ||
position: number; | ||
|
||
/** | ||
* The length of the emote in the message. | ||
*/ | ||
length: number; | ||
|
||
/** | ||
* The ID of the emote. | ||
*/ | ||
id: string; | ||
|
||
/** | ||
* The name of the emote. | ||
*/ | ||
name: string; | ||
} | ||
|
||
/** | ||
* A part of a parsed message. | ||
*/ | ||
export type ParsedMessagePart = ParsedMessageTextPart | ParsedMessageCheerPart | ParsedMessageEmotePart; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.