@imessaging/core 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imessaging/core",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "Core messaging transport contracts and Telegram peer storage",
5
5
  "keywords": [
6
6
  "messaging",
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export { createPeerKey } from "./peer-key";
16
16
  export {
17
17
  canEdit,
18
18
  canMarkRead,
19
+ canReact,
19
20
  canReceive,
20
21
  canShowTyping,
21
22
  hasCommandMenu,
@@ -39,11 +40,13 @@ export type {
39
40
  EmailRecipient,
40
41
  HeadhunterRecipient,
41
42
  MaxRecipient,
43
+ MessageReaction,
42
44
  MessageRecipient,
43
45
  MessageTransport,
44
46
  OutboundButton,
45
47
  OutboundDocument,
46
48
  OutboundMessage,
49
+ ReactionTransport,
47
50
  ResolvedPeer,
48
51
  SendResult,
49
52
  TelegramPeerStore,
package/src/types.ts CHANGED
@@ -162,6 +162,21 @@ export function canEdit(transport: MessageTransport): transport is EditableMessa
162
162
  return typeof (transport as EditableMessageTransport).edit === "function";
163
163
  }
164
164
 
165
+ export type MessageReaction = {
166
+ recipient: MessageRecipient;
167
+ messageId: string;
168
+ /** Эмодзи реакции; не задано или пусто — снять реакции учётки с сообщения. */
169
+ emoji?: string;
170
+ };
171
+
172
+ export interface ReactionTransport extends MessageTransport {
173
+ react(reaction: MessageReaction): Promise<void>;
174
+ }
175
+
176
+ export function canReact(transport: MessageTransport): transport is ReactionTransport {
177
+ return typeof (transport as ReactionTransport).react === "function";
178
+ }
179
+
165
180
  export type ResolvedPeer = {
166
181
  type: "user" | "group" | "channel";
167
182
  id: string;
@@ -283,6 +298,8 @@ export type IncomingMessage = {
283
298
  sentAt?: Date;
284
299
  /** Когда правили последний раз. Нет — не правили. */
285
300
  editedAt?: Date;
301
+ /** В сообщении упомянут аккаунт или это ответ на его сообщение (так Telegram определяет упоминание); нет — канал не сообщает. */
302
+ mentionsMe?: boolean;
286
303
  attachments: IncomingAttachment[];
287
304
  /**
288
305
  * Адреса из сообщения, в порядке появления.