feat: updated to 145 layer
This commit is contained in:
parent
597cb4f07b
commit
77bfef98d1
14 changed files with 86 additions and 36 deletions
|
@ -14,7 +14,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/long": "^4.0.1",
|
"@types/long": "^4.0.1",
|
||||||
"@types/node": "^15.12.1",
|
"@types/node": "^15.12.1",
|
||||||
"@mtcute/tl": "workspace:^144.0.0",
|
"@mtcute/tl": "workspace:^145.0.0",
|
||||||
"@mtcute/core": "workspace:^1.0.0",
|
"@mtcute/core": "workspace:^1.0.0",
|
||||||
"@mtcute/file-id": "workspace:^1.0.0",
|
"@mtcute/file-id": "workspace:^1.0.0",
|
||||||
"eager-async-pool": "^1.0.0",
|
"eager-async-pool": "^1.0.0",
|
||||||
|
|
|
@ -2664,6 +2664,11 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
*/
|
*/
|
||||||
emoji?: string
|
emoji?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get only reactions with the specified custom emoji
|
||||||
|
*/
|
||||||
|
customEmoji?: tl.Long
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit the number of events returned.
|
* Limit the number of events returned.
|
||||||
*
|
*
|
||||||
|
@ -3188,14 +3193,14 @@ export interface TelegramClient extends BaseTelegramClient {
|
||||||
*
|
*
|
||||||
* @param chatId Chat ID with the message to react to
|
* @param chatId Chat ID with the message to react to
|
||||||
* @param message Message ID to react to
|
* @param message Message ID to react to
|
||||||
* @param emoji Reaction emoji (or `null` to remove)
|
* @param emoji Reaction emoji (if `tl.Long` then this is a custom emoji) or `null` to remove
|
||||||
* @param big (default: `false`) Whether to use a big reaction
|
* @param big (default: `false`) Whether to use a big reaction
|
||||||
* @returns Message to which the reaction was sent
|
* @returns Message to which the reaction was sent
|
||||||
*/
|
*/
|
||||||
sendReaction(
|
sendReaction(
|
||||||
chatId: InputPeerLike,
|
chatId: InputPeerLike,
|
||||||
message: number,
|
message: number,
|
||||||
emoji: string | null,
|
emoji: string | tl.Long | null,
|
||||||
big?: boolean
|
big?: boolean
|
||||||
): Promise<Message>
|
): Promise<Message>
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,11 @@ export async function* getReactionUsers(
|
||||||
*/
|
*/
|
||||||
emoji?: string
|
emoji?: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get only reactions with the specified custom emoji
|
||||||
|
*/
|
||||||
|
customEmoji?: tl.Long
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Limit the number of events returned.
|
* Limit the number of events returned.
|
||||||
*
|
*
|
||||||
|
@ -51,7 +56,19 @@ export async function* getReactionUsers(
|
||||||
_: 'messages.getMessageReactionsList',
|
_: 'messages.getMessageReactionsList',
|
||||||
peer,
|
peer,
|
||||||
id: messageId,
|
id: messageId,
|
||||||
reaction: params.emoji,
|
reaction: params.customEmoji
|
||||||
|
? {
|
||||||
|
_: 'reactionCustomEmoji',
|
||||||
|
documentId: params.customEmoji,
|
||||||
|
}
|
||||||
|
: params.emoji
|
||||||
|
? {
|
||||||
|
_: 'reactionEmoji',
|
||||||
|
emoticon: params.emoji,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
_: 'reactionEmpty',
|
||||||
|
},
|
||||||
limit: Math.min(chunkSize, total - current),
|
limit: Math.min(chunkSize, total - current),
|
||||||
offset,
|
offset,
|
||||||
})
|
})
|
||||||
|
|
|
@ -8,13 +8,14 @@ import {
|
||||||
PeersIndex,
|
PeersIndex,
|
||||||
} from '../../types'
|
} from '../../types'
|
||||||
import { assertIsUpdatesGroup } from '../../utils/updates-utils'
|
import { assertIsUpdatesGroup } from '../../utils/updates-utils'
|
||||||
|
import Long from 'long'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send or remove a reaction.
|
* Send or remove a reaction.
|
||||||
*
|
*
|
||||||
* @param chatId Chat ID with the message to react to
|
* @param chatId Chat ID with the message to react to
|
||||||
* @param message Message ID to react to
|
* @param message Message ID to react to
|
||||||
* @param emoji Reaction emoji (or `null` to remove)
|
* @param emoji Reaction emoji (if `tl.Long` then this is a custom emoji) or `null` to remove
|
||||||
* @param big Whether to use a big reaction
|
* @param big Whether to use a big reaction
|
||||||
* @returns Message to which the reaction was sent
|
* @returns Message to which the reaction was sent
|
||||||
* @internal
|
* @internal
|
||||||
|
@ -23,14 +24,28 @@ export async function sendReaction(
|
||||||
this: TelegramClient,
|
this: TelegramClient,
|
||||||
chatId: InputPeerLike,
|
chatId: InputPeerLike,
|
||||||
message: number,
|
message: number,
|
||||||
emoji: string | null,
|
emoji: string | tl.Long | null,
|
||||||
big = false
|
big = false
|
||||||
): Promise<Message> {
|
): Promise<Message> {
|
||||||
const res = await this.call({
|
const res = await this.call({
|
||||||
_: 'messages.sendReaction',
|
_: 'messages.sendReaction',
|
||||||
peer: await this.resolvePeer(chatId),
|
peer: await this.resolvePeer(chatId),
|
||||||
msgId: message,
|
msgId: message,
|
||||||
reaction: emoji ?? undefined,
|
reaction: [
|
||||||
|
Long.isLong(emoji)
|
||||||
|
? {
|
||||||
|
_: 'reactionCustomEmoji',
|
||||||
|
documentId: emoji,
|
||||||
|
}
|
||||||
|
: emoji
|
||||||
|
? {
|
||||||
|
_: 'reactionEmoji',
|
||||||
|
emoticon: emoji,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
_: 'reactionEmpty',
|
||||||
|
},
|
||||||
|
],
|
||||||
big,
|
big,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ const sentCodeMap: Record<
|
||||||
'auth.sentCodeTypeFlashCall': 'flash_call',
|
'auth.sentCodeTypeFlashCall': 'flash_call',
|
||||||
'auth.sentCodeTypeSms': 'sms',
|
'auth.sentCodeTypeSms': 'sms',
|
||||||
'auth.sentCodeTypeMissedCall': 'missed_call',
|
'auth.sentCodeTypeMissedCall': 'missed_call',
|
||||||
|
'auth.sentCodeTypeEmailCode': 'email',
|
||||||
|
'auth.sentCodeTypeSetUpEmailRequired': 'email_required',
|
||||||
}
|
}
|
||||||
|
|
||||||
const nextCodeMap: Record<
|
const nextCodeMap: Record<
|
||||||
|
@ -37,6 +39,8 @@ export namespace SentCode {
|
||||||
| 'call'
|
| 'call'
|
||||||
| 'flash_call'
|
| 'flash_call'
|
||||||
| 'missed_call'
|
| 'missed_call'
|
||||||
|
| 'email'
|
||||||
|
| 'email_required'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type describing next code delivery type.
|
* Type describing next code delivery type.
|
||||||
|
@ -51,20 +55,14 @@ export namespace SentCode {
|
||||||
* Information about sent confirmation code
|
* Information about sent confirmation code
|
||||||
*/
|
*/
|
||||||
export class SentCode {
|
export class SentCode {
|
||||||
/**
|
constructor(readonly raw: tl.auth.TypeSentCode) {
|
||||||
* Underlying raw TL object
|
|
||||||
*/
|
|
||||||
readonly sentCode: tl.auth.TypeSentCode
|
|
||||||
|
|
||||||
constructor(obj: tl.auth.TypeSentCode) {
|
|
||||||
this.sentCode = obj
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Type of currently sent confirmation code
|
* Type of currently sent confirmation code
|
||||||
*/
|
*/
|
||||||
get type(): SentCode.DeliveryType {
|
get type(): SentCode.DeliveryType {
|
||||||
return sentCodeMap[this.sentCode.type._]
|
return sentCodeMap[this.raw.type._]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -72,8 +70,8 @@ export class SentCode {
|
||||||
* if you call {@link TelegramClient.resendCode}.
|
* if you call {@link TelegramClient.resendCode}.
|
||||||
*/
|
*/
|
||||||
get nextType(): SentCode.NextDeliveryType {
|
get nextType(): SentCode.NextDeliveryType {
|
||||||
return this.sentCode.nextType
|
return this.raw.nextType
|
||||||
? nextCodeMap[this.sentCode.nextType._]
|
? nextCodeMap[this.raw.nextType._]
|
||||||
: 'none'
|
: 'none'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,21 +80,21 @@ export class SentCode {
|
||||||
* (like {@link TelegramClient.signIn} and {@link TelegramClient.signUp})
|
* (like {@link TelegramClient.signIn} and {@link TelegramClient.signUp})
|
||||||
*/
|
*/
|
||||||
get phoneCodeHash(): string {
|
get phoneCodeHash(): string {
|
||||||
return this.sentCode.phoneCodeHash
|
return this.raw.phoneCodeHash
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delay in seconds to wait before calling {@link TelegramClient.resendCode}
|
* Delay in seconds to wait before calling {@link TelegramClient.resendCode}
|
||||||
*/
|
*/
|
||||||
get timeout(): number {
|
get timeout(): number {
|
||||||
return this.sentCode.timeout ?? 0
|
return this.raw.timeout ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Length of the code (0 for flash calls)
|
* Length of the code (0 for flash calls)
|
||||||
*/
|
*/
|
||||||
get length(): number {
|
get length(): number {
|
||||||
return 'length' in this.sentCode.type ? this.sentCode.type.length : 0
|
return 'length' in this.raw.type ? this.raw.type.length : 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,22 @@ export class PeerReaction {
|
||||||
* Emoji representing the reaction
|
* Emoji representing the reaction
|
||||||
*/
|
*/
|
||||||
get emoji(): string {
|
get emoji(): string {
|
||||||
return this.raw.reaction!
|
const r = this.raw.reaction
|
||||||
|
switch (r._) {
|
||||||
|
case 'reactionCustomEmoji':
|
||||||
|
return r.documentId.toString()
|
||||||
|
case 'reactionEmoji':
|
||||||
|
return r.emoticon
|
||||||
|
case 'reactionEmpty':
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this reaction is a custom emoji
|
||||||
|
*/
|
||||||
|
get isCustomEmoji(): boolean {
|
||||||
|
return this.raw.reaction._ === 'reactionCustomEmoji'
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
"@types/node": "^15.12.1",
|
"@types/node": "^15.12.1",
|
||||||
"@types/events": "^3.0.0",
|
"@types/events": "^3.0.0",
|
||||||
"@types/long": "^4.0.2",
|
"@types/long": "^4.0.2",
|
||||||
"@mtcute/tl": "workspace:^144.0.0",
|
"@mtcute/tl": "workspace:^145.0.0",
|
||||||
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
||||||
"big-integer": "1.6.48",
|
"big-integer": "1.6.48",
|
||||||
"long": "^4.0.0",
|
"long": "^4.0.0",
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^144.0.0",
|
"@mtcute/tl": "workspace:^145.0.0",
|
||||||
"@mtcute/core": "workspace:^1.0.0",
|
"@mtcute/core": "workspace:^1.0.0",
|
||||||
"@mtcute/client": "workspace:^1.0.0",
|
"@mtcute/client": "workspace:^1.0.0",
|
||||||
"events": "^3.2.0"
|
"events": "^3.2.0"
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
"build": "tsc"
|
"build": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^144.0.0",
|
"@mtcute/tl": "workspace:^145.0.0",
|
||||||
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
"@mtcute/tl-runtime": "workspace:^1.0.0",
|
||||||
"@mtcute/core": "workspace:^1.0.0",
|
"@mtcute/core": "workspace:^1.0.0",
|
||||||
"long": "^4.0.0"
|
"long": "^4.0.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"docs": "typedoc"
|
"docs": "typedoc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^144.0.0",
|
"@mtcute/tl": "workspace:^145.0.0",
|
||||||
"htmlparser2": "^6.0.1",
|
"htmlparser2": "^6.0.1",
|
||||||
"long": "^4.0.0"
|
"long": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"docs": "typedoc"
|
"docs": "typedoc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mtcute/tl": "workspace:^144.0.0",
|
"@mtcute/tl": "workspace:^145.0.0",
|
||||||
"long": "^4.0.0"
|
"long": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
> TL schema and related utils used for MTCute.
|
> TL schema and related utils used for MTCute.
|
||||||
|
|
||||||
Generated from TL layer **144** (last updated on 18.08.2022).
|
Generated from TL layer **145** (last updated on 03.09.2022).
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@mtcute/tl",
|
"name": "@mtcute/tl",
|
||||||
"version": "144.0.0",
|
"version": "145.0.0",
|
||||||
"description": "TL schema used for MTCute",
|
"description": "TL schema used for MTCute",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "Alina Sireneva <me@tei.su>",
|
"author": "Alina Sireneva <me@tei.su>",
|
||||||
|
|
Loading…
Reference in a new issue