File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -138,6 +138,18 @@ The above code will create a text like this:
138138
139139> Hello, [ @fedify @hollo.social] ( https://hollo.social/@fedify ) .
140140
141+ ### ` Emoji `
142+
143+ * This API is available since BotKit 0.2.0.*
144+
145+ If you put an ` Emoji ` object (provided by Fedify) inside the interpolation,
146+ it will be rendered as a custom emoji. You usually get ` Emoji ` objects from
147+ the ` Reaction.emoji ` property. For example:
148+
149+ ~~~~ typescript
150+ text ` Here's a custom emoji: ${reaction .emoji }. `
151+ ~~~~
152+
141153### ` URL ` object
142154
143155If you put a ` URL ` object inside the interpolation, it will be rendered as a
Original file line number Diff line number Diff line change 1515// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616import {
1717 type Actor ,
18- type Emoji ,
18+ Emoji ,
1919 getActorHandle ,
2020 isActor ,
2121 Link ,
@@ -129,6 +129,7 @@ export class TemplatedText<TContextData>
129129 if ( isText < TContextData > ( v ) ) return v ;
130130 if ( v instanceof URL ) return link ( v ) ;
131131 if ( isActor ( v ) ) return mention ( v ) ;
132+ if ( v instanceof Emoji ) return customEmoji ( v ) ;
132133 return new PlainText ( String ( v ) ) ;
133134 } ) ;
134135 }
You can’t perform that action at this time.
0 commit comments