File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,18 @@ The above code will create a text like this:
138
138
139
139
> Hello, [ @fedify @hollo.social] ( https://hollo.social/@fedify ) .
140
140
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
+
141
153
### ` URL ` object
142
154
143
155
If you put a ` URL ` object inside the interpolation, it will be rendered as a
Original file line number Diff line number Diff line change 15
15
// along with this program. If not, see <https://www.gnu.org/licenses/>.
16
16
import {
17
17
type Actor ,
18
- type Emoji ,
18
+ Emoji ,
19
19
getActorHandle ,
20
20
isActor ,
21
21
Link ,
@@ -30,7 +30,7 @@ import {
30
30
} from "@fedify/markdown-it-mention" ;
31
31
import { escape } from "@std/html/entities" ;
32
32
import MarkdownIt from "markdown-it" ;
33
- import type { DeferredCustomEmoji } from "./emoji.ts" ;
33
+ import { type DeferredCustomEmoji , emoji } from "./emoji.ts" ;
34
34
import type { Session } from "./session.ts" ;
35
35
36
36
/**
@@ -129,6 +129,7 @@ export class TemplatedText<TContextData>
129
129
if ( isText < TContextData > ( v ) ) return v ;
130
130
if ( v instanceof URL ) return link ( v ) ;
131
131
if ( isActor ( v ) ) return mention ( v ) ;
132
+ if ( v instanceof Emoji ) return customEmoji ( v ) ;
132
133
return new PlainText ( String ( v ) ) ;
133
134
} ) ;
134
135
}
You can’t perform that action at this time.
0 commit comments