You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
awaitctx.forward(toChat); // This forwards the received message.
240
240
});
241
241
```
242
+
243
+
## Pinned Messages
244
+
245
+
Pinning a message keeps it at the top of a chat so members can find it easily. Both users and bots can pin messages, provided they have the rights to do so in the chat.
246
+
247
+
### Pinning a Message
248
+
249
+
Use {{ "pinMessage" |> m }} to pin a message.
250
+
251
+
```ts
252
+
awaitclient.pinMessage(chatId, messageId);
253
+
```
254
+
255
+
In private chats, the pin is visible to both participants by default. Pass `isForBothSides` as `false` to pin it only for the current account.
256
+
257
+
```ts
258
+
awaitclient.pinMessage(chatId, messageId, {
259
+
isForBothSides: false,
260
+
});
261
+
```
262
+
263
+
Pass `isSilent` to pin without notifying the chat.
264
+
265
+
```ts
266
+
awaitclient.pinMessage(chatId, messageId, {
267
+
isSilent: true,
268
+
});
269
+
```
270
+
271
+
### Unpinning Messages
272
+
273
+
Use {{ "unpinMessage" |> m }} to unpin a single message.
274
+
275
+
```ts
276
+
awaitclient.unpinMessage(chatId, messageId);
277
+
```
278
+
279
+
Use {{ "unpinMessages" |> m }} to unpin every pinned message in a chat at once.
280
+
281
+
```ts
282
+
awaitclient.unpinMessages(chatId);
283
+
```
284
+
285
+
In a forum, pass a `topicId` to unpin only the messages in that topic.
286
+
287
+
```ts
288
+
awaitclient.unpinMessages(chatId, {
289
+
topicId,
290
+
});
291
+
```
292
+
293
+
### Receiving Pin Notifications
294
+
295
+
When a message is pinned in a group, a service message of type `pinnedMessage` is added to the chat. Listen for it like any other message, and read the pinned message through `ctx.msg.pinnedMessage`.
0 commit comments