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