diff --git a/.env b/.env
index b9424597..275377ca 100644
--- a/.env
+++ b/.env
@@ -1,5 +1,5 @@
API_ID=1025907
API_HASH=452b0359b988148995f22ff0f4229750
-VERSION=0.8.6
-VERSION_FULL=0.8.6 (6)
-BUILD=6
+VERSION=0.9.0
+VERSION_FULL=0.9.0 (10)
+BUILD=10
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b43353f4..10755202 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+### 0.9.0 (10)
+* Application can now work with new 64-bit identifiers
+* Added Swipe-to-Reply on devices with touchscreen
+* Refactored folders & dialogs
+* Added confirmation popups for logging out, canceling message editing
+* Fixed sending video as file
+* Fixed loading document's thumbnail on sending and forwarding
+* Fixed inability to open a media sent as file in media viewer
+* Other bugfixes and improvements
+
### 0.8.6
* Added changelogs.
* Audio player improvements: seek, next/previous buttons, volume controls. Changing volume in the video player will affect audio as well.
diff --git a/build.js b/build.js
index e2f48b59..1a1b0b65 100644
--- a/build.js
+++ b/build.js
@@ -3,7 +3,7 @@
const { spawn } = require('child_process');
const version = process.argv[2] || 'same';
-const changelog = '';
+const changelog = process.argv[3] || '';
const child = spawn(`npm`, ['run', 'change-version', version, changelog].filter(Boolean));
child.stdout.on('data', (chunk) => {
console.log(chunk.toString());
diff --git a/public/assets/fonts/tgico.svg b/public/assets/fonts/tgico.svg
index 12bd3971..44ff26ae 100644
--- a/public/assets/fonts/tgico.svg
+++ b/public/assets/fonts/tgico.svg
@@ -7,153 +7,158 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/assets/fonts/tgico.ttf b/public/assets/fonts/tgico.ttf
index a8ea972c..377b0b5d 100644
Binary files a/public/assets/fonts/tgico.ttf and b/public/assets/fonts/tgico.ttf differ
diff --git a/public/assets/fonts/tgico.woff b/public/assets/fonts/tgico.woff
index 5afa2918..15e0b5e7 100644
Binary files a/public/assets/fonts/tgico.woff and b/public/assets/fonts/tgico.woff differ
diff --git a/public/assets/img/avatarnext.svg b/public/assets/img/avatarnext.svg
deleted file mode 100644
index 77ce415c..00000000
--- a/public/assets/img/avatarnext.svg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/public/assets/img/avatarprevious.svg b/public/assets/img/avatarprevious.svg
deleted file mode 100644
index 5e58b96a..00000000
--- a/public/assets/img/avatarprevious.svg
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/public/changelogs/0.9.0 (10).md b/public/changelogs/0.9.0 (10).md
new file mode 100644
index 00000000..1d6e5696
--- /dev/null
+++ b/public/changelogs/0.9.0 (10).md
@@ -0,0 +1,8 @@
+• Application can now work with new 64-bit identifiers
+• Added Swipe-to-Reply on devices with touchscreen
+• Refactored folders & dialogs
+• Added confirmation popups for logging out, canceling message editing
+• Fixed sending video as file
+• Fixed loading document's thumbnail on sending and forwarding
+• Fixed inability to open a media sent as file in media viewer
+• Other bugfixes and improvements
diff --git a/src/components/animationIntersector.ts b/src/components/animationIntersector.ts
index e1f6f53d..97e0404f 100644
--- a/src/components/animationIntersector.ts
+++ b/src/components/animationIntersector.ts
@@ -9,6 +9,7 @@ import rootScope from "../lib/rootScope";
import { IS_SAFARI } from "../environment/userAgent";
import { MOUNT_CLASS_TO } from "../config/debug";
import isInDOM from "../helpers/dom/isInDOM";
+import { indexOfAndSplice } from "../helpers/array";
export interface AnimationItem {
el: HTMLElement,
@@ -101,7 +102,7 @@ export class AnimationIntersector {
}
for(const group in this.byGroups) {
- this.byGroups[group].findAndSplice(p => p === player);
+ indexOfAndSplice(this.byGroups[group], player);
}
this.observer.unobserve(el);
diff --git a/src/components/appMediaPlaybackController.ts b/src/components/appMediaPlaybackController.ts
index 68b2b4ff..79db41f3 100644
--- a/src/components/appMediaPlaybackController.ts
+++ b/src/components/appMediaPlaybackController.ts
@@ -27,7 +27,7 @@ import { onMediaLoad } from "../helpers/files";
// TODO: Safari: попробовать замаскировать подгрузку последнего чанка
// TODO: Safari: пофиксить момент, когда заканчивается песня и пытаешься включить её заново - прогресс сразу в конце
-export type MediaItem = {mid: number, peerId: number};
+export type MediaItem = {mid: number, peerId: PeerId};
type HTMLMediaElement = HTMLAudioElement | HTMLVideoElement;
@@ -47,9 +47,9 @@ export type MediaSearchContext = SearchSuperContext & Partial<{
}>;
type MediaDetails = {
- peerId: number,
+ peerId: PeerId,
mid: number,
- docId: string,
+ docId: DocId,
clean?: boolean,
isScheduled?: boolean,
isSingle?: boolean
@@ -57,12 +57,12 @@ type MediaDetails = {
class AppMediaPlaybackController {
private container: HTMLElement;
- private media: Map> = new Map();
+ private media: Map> = new Map();
private scheduled: AppMediaPlaybackController['media'] = new Map();
private mediaDetails: Map = new Map();
private playingMedia: HTMLMediaElement;
- private waitingMediaForLoad: Map>> = new Map();
+ private waitingMediaForLoad: Map>> = new Map();
private waitingScheduledMediaForLoad: AppMediaPlaybackController['waitingMediaForLoad'] = new Map();
private waitingDocumentsForLoad: {[docId: string]: Set} = {};
@@ -271,7 +271,7 @@ class AppMediaPlaybackController {
return media;
}
- public getMedia(peerId: number, mid: number, isScheduled?: boolean) {
+ public getMedia(peerId: PeerId, mid: number, isScheduled?: boolean) {
const s = (isScheduled ? this.scheduled : this.media).get(peerId);
return s?.get(mid);
}
@@ -326,7 +326,7 @@ class AppMediaPlaybackController {
}/* , {once: true} */);
}
- public resolveWaitingForLoadMedia(peerId: number, mid: number, isScheduled?: boolean) {
+ public resolveWaitingForLoadMedia(peerId: PeerId, mid: number, isScheduled?: boolean) {
const w = isScheduled ? this.waitingScheduledMediaForLoad : this.waitingMediaForLoad;
const storage = w.get(peerId);
if(!storage) {
diff --git a/src/components/appMediaViewer.ts b/src/components/appMediaViewer.ts
index fa7ebaf8..35bfd2b8 100644
--- a/src/components/appMediaViewer.ts
+++ b/src/components/appMediaViewer.ts
@@ -28,7 +28,7 @@ import AppSharedMediaTab from "./sidebarRight/tabs/sharedMedia";
type AppMediaViewerTargetType = {
element: HTMLElement,
mid: number,
- peerId: number
+ peerId: PeerId
};
export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delete' | 'forward', AppMediaViewerTargetType> {
protected btnMenuDelete: HTMLElement;
@@ -157,7 +157,7 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
return promise;
} */
- protected getMessageByPeer(peerId: number, mid: number) {
+ protected getMessageByPeer(peerId: PeerId, mid: number) {
return this.searchContext.isScheduled ? appMessagesManager.getScheduledMessageByPeer(peerId, mid) : appMessagesManager.getMessageByPeer(peerId, mid);
}
@@ -193,6 +193,7 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
const {mid, peerId} = this.target;
if(mid && mid !== Number.MAX_SAFE_INTEGER) {
const threadId = this.searchContext.threadId;
+ const message = this.getMessageByPeer(peerId, mid);
this.close(e)
//.then(() => mediaSizes.isMobile ? appSidebarRight.sharedMediaTab.closeBtn.click() : Promise.resolve())
.then(() => {
@@ -203,7 +204,6 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
}
}
- const message = this.getMessageByPeer(peerId, mid);
appImManager.setInnerPeer(message.peerId, mid, threadId ? 'discussion' : undefined, threadId);
});
}
diff --git a/src/components/appMediaViewerAvatar.ts b/src/components/appMediaViewerAvatar.ts
index a8e9ee64..17722156 100644
--- a/src/components/appMediaViewerAvatar.ts
+++ b/src/components/appMediaViewerAvatar.ts
@@ -5,15 +5,16 @@
*/
import AvatarListLoader from "../helpers/avatarListLoader";
+import { Photo } from "../layer";
import appImManager from "../lib/appManagers/appImManager";
import appPhotosManager from "../lib/appManagers/appPhotosManager";
import AppMediaViewerBase from "./appMediaViewerBase";
-type AppMediaViewerAvatarTargetType = {element: HTMLElement, photoId: string};
+type AppMediaViewerAvatarTargetType = {element: HTMLElement, photoId: Photo.photo['id']};
export default class AppMediaViewerAvatar extends AppMediaViewerBase<'', 'delete', AppMediaViewerAvatarTargetType> {
- public peerId: number;
+ public peerId: PeerId;
- constructor(peerId: number) {
+ constructor(peerId: PeerId) {
super(new AvatarListLoader({peerId}), [/* 'delete' */]);
this.peerId = peerId;
@@ -45,7 +46,7 @@ export default class AppMediaViewerAvatar extends AppMediaViewerBase<'', 'delete
appPhotosManager.savePhotoFile(appPhotosManager.getPhoto(this.target.photoId), appImManager.chat.bubbles.lazyLoadQueue.queueId);
};
- public async openMedia(photoId: string, target?: HTMLElement, fromRight = 0, prevTargets?: AppMediaViewerAvatarTargetType[], nextTargets?: AppMediaViewerAvatarTargetType[]) {
+ public async openMedia(photoId: Photo.photo['id'], target?: HTMLElement, fromRight = 0, prevTargets?: AppMediaViewerAvatarTargetType[], nextTargets?: AppMediaViewerAvatarTargetType[]) {
if(this.setMoverPromise) return this.setMoverPromise;
const photo = appPhotosManager.getPhoto(photoId);
diff --git a/src/components/appMediaViewerBase.ts b/src/components/appMediaViewerBase.ts
index 43dd7669..4b9bdd64 100644
--- a/src/components/appMediaViewerBase.ts
+++ b/src/components/appMediaViewerBase.ts
@@ -1096,7 +1096,7 @@ export default class AppMediaViewerBase<
} */
}
- protected setAuthorInfo(fromId: number, timestamp: number) {
+ protected setAuthorInfo(fromId: PeerId, timestamp: number) {
replaceContent(this.author.date, formatFullSentTime(timestamp));
replaceContent(this.author.nameEl, new PeerTitle({
@@ -1115,7 +1115,7 @@ export default class AppMediaViewerBase<
protected async _openMedia(
media: MyDocument | MyPhoto,
timestamp: number,
- fromId: number,
+ fromId: PeerId,
fromRight: number,
target?: HTMLElement,
reverse = false,
diff --git a/src/components/appMediaViewerNew.ts b/src/components/appMediaViewerNew.ts
index 7011613b..66d51c18 100644
--- a/src/components/appMediaViewerNew.ts
+++ b/src/components/appMediaViewerNew.ts
@@ -1080,7 +1080,7 @@
// type AppMediaViewerTargetType = {
// element: HTMLElement,
// mid: number,
-// peerId: number
+// peerId: PeerId
// };
// export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delete' | 'forward', AppMediaViewerTargetType> {
// public currentMessageId = 0;
@@ -1336,9 +1336,9 @@
// type AppMediaViewerAvatarTargetType = {element: HTMLElement, photoId: string};
// export class AppMediaViewerAvatar extends AppMediaViewerBase<'', 'delete', AppMediaViewerAvatarTargetType> {
// public currentPhotoId: string;
-// public peerId: number;
+// public peerId: PeerId;
-// constructor(peerId: number) {
+// constructor(peerId: PeerId) {
// super(['delete']);
// this.peerId = peerId;
@@ -1373,7 +1373,7 @@
// };
// protected loadMoreMedia = (older = true) => {
-// if(this.peerId < 0) return Promise.resolve(); // ! это значит, что открыло аватар чата, но следующих фотографий нет.
+// if(this.peerId.isAnyChat()) return Promise.resolve(); // ! это значит, что открыло аватар чата, но следующих фотографий нет.
// if(this.loadedAllMediaDown) return Promise.resolve();
// if(this.loadMediaPromiseDown) return this.loadMediaPromiseDown;
diff --git a/src/components/appNavigationController.ts b/src/components/appNavigationController.ts
index 45291d0b..52a20c48 100644
--- a/src/components/appNavigationController.ts
+++ b/src/components/appNavigationController.ts
@@ -10,6 +10,8 @@ import { logger } from "../lib/logger";
import { doubleRaf } from "../helpers/schedulers";
import blurActiveElement from "../helpers/dom/blurActiveElement";
import { cancelEvent } from "../helpers/dom/cancelEvent";
+import { indexOfAndSplice } from "../helpers/array";
+import isSwipingBackSafari from "../helpers/dom/isSwipingBackSafari";
export type NavigationItem = {
type: 'left' | 'right' | 'im' | 'chat' | 'popup' | 'media' | 'menu' |
@@ -73,7 +75,17 @@ export class AppNavigationController {
if(e.touches.length > 1) return;
this.debug && this.log('touchstart');
- const detach = () => {
+ if(isSwipingBackSafari(e)) {
+ isPossibleSwipe = true;
+
+ window.addEventListener('touchend', () => {
+ setTimeout(() => {
+ isPossibleSwipe = false;
+ }, 100);
+ }, {passive: true, once: true});
+ }
+
+ /* const detach = () => {
window.removeEventListener('touchend', onTouchEnd);
window.removeEventListener('touchmove', onTouchMove);
};
@@ -105,7 +117,7 @@ export class AppNavigationController {
};
window.addEventListener('touchend', onTouchEnd, options);
- window.addEventListener('touchmove', onTouchMove, options);
+ window.addEventListener('touchmove', onTouchMove, options); */
}, options);
}
@@ -171,7 +183,7 @@ export class AppNavigationController {
}
public removeItem(item: NavigationItem) {
- this.navigations.findAndSplice(i => i === item);
+ indexOfAndSplice(this.navigations, item);
}
public removeByType(type: NavigationItem['type'], single = false) {
diff --git a/src/components/appSearch.ts b/src/components/appSearch.ts
index a917bd54..e4f19510 100644
--- a/src/components/appSearch.ts
+++ b/src/components/appSearch.ts
@@ -74,7 +74,7 @@ export default class AppSearch {
private listsContainer: HTMLDivElement = null;
- private peerId = 0; // 0 - means global
+ private peerId: PeerId; // 0 - means global
private threadId = 0;
private scrollable: Scrollable;
@@ -117,7 +117,7 @@ export default class AppSearch {
if(all) {
this.searchInput.value = '';
this.query = '';
- this.peerId = 0;
+ this.peerId = undefined;
this.threadId = 0;
}
@@ -132,7 +132,7 @@ export default class AppSearch {
this.searchPromise = null;
}
- public beginSearch(peerId = 0, threadId = 0, query = '') {
+ public beginSearch(peerId?: PeerId, threadId = 0, query = '') {
this.peerId = peerId;
this.threadId = threadId;
diff --git a/src/components/appSearchSuper..ts b/src/components/appSearchSuper..ts
index 781f4777..ac0fbae2 100644
--- a/src/components/appSearchSuper..ts
+++ b/src/components/appSearchSuper..ts
@@ -50,12 +50,13 @@ import { cancelEvent } from "../helpers/dom/cancelEvent";
import { attachClickEvent, simulateClickEvent } from "../helpers/dom/clickEvent";
import { MyDocument } from "../lib/appManagers/appDocsManager";
import AppMediaViewer from "./appMediaViewer";
+import lockTouchScroll from "../helpers/dom/lockTouchScroll";
//const testScroll = false;
export type SearchSuperType = MyInputMessagesFilter/* | 'members' */;
export type SearchSuperContext = {
- peerId: number,
+ peerId: PeerId,
inputFilter: {_: MyInputMessagesFilter},
query?: string,
maxId?: number,
@@ -81,7 +82,7 @@ class SearchContextMenu {
private buttons: (ButtonMenuItemOptions & {verify?: () => boolean, withSelection?: true})[];
private element: HTMLElement;
private target: HTMLElement;
- private peerId: number;
+ private peerId: PeerId;
private mid: number;
private isSelected: boolean;
@@ -109,7 +110,7 @@ class SearchContextMenu {
if(e instanceof MouseEvent) e.cancelBubble = true;
this.target = item;
- this.peerId = +item.dataset.peerId;
+ this.peerId = item.dataset.peerId.toPeerId();
this.mid = +item.dataset.mid;
this.isSelected = searchSuper.selection.isMidSelected(this.peerId, this.mid);
@@ -236,7 +237,7 @@ export default class AppSearchSuper {
private lazyLoadQueue = new LazyLoadQueue();
public middleware = getMiddleware();
- public historyStorage: Partial<{[type in SearchSuperType]: {mid: number, peerId: number}[]}> = {};
+ public historyStorage: Partial<{[type in SearchSuperType]: {mid: number, peerId: PeerId}[]}> = {};
public usedFromHistory: Partial<{[type in SearchSuperType]: number}> = {};
public urlsToRevoke: string[] = [];
@@ -326,10 +327,35 @@ export default class AppSearchSuper {
this.tabsContainer = document.createElement('div');
this.tabsContainer.classList.add('search-super-tabs-container', 'tabs-container');
+ let unlockScroll: ReturnType;
if(IS_TOUCH_SUPPORTED) {
- handleTabSwipe(this.tabsContainer, (next) => {
- const prevId = this.selectTab.prevId();
- this.selectTab(next ? prevId + 1 : prevId - 1);
+ handleTabSwipe({
+ element: this.tabsContainer,
+ onSwipe: (xDiff, yDiff, e) => {
+ const prevId = this.selectTab.prevId();
+ const children = Array.from(this.tabsMenu.children) as HTMLElement[];
+ let idx: number;
+ if(xDiff > 0) {
+ for(let i = prevId + 1; i < children.length; ++i) {
+ if(!children[i].classList.contains('hide')) {
+ idx = i;
+ break;
+ }
+ }
+ } else {
+ for(let i = prevId - 1; i >= 0; --i) {
+ if(!children[i].classList.contains('hide')) {
+ idx = i;
+ break;
+ }
+ }
+ }
+
+ if(idx !== undefined) {
+ unlockScroll = lockTouchScroll(this.tabsContainer);
+ this.selectTab(idx);
+ }
+ }
});
}
@@ -441,6 +467,11 @@ export default class AppSearchSuper {
this.scrollable.scrollTop = this.mediaTab.scroll.scrollTop;
}
+ if(unlockScroll) {
+ unlockScroll();
+ unlockScroll = undefined;
+ }
+
this.onTransitionEnd();
}, undefined, navScrollable);
@@ -461,14 +492,14 @@ export default class AppSearchSuper {
return;
}
- const peerId = +target.dataset.peerId;
+ const peerId = target.dataset.peerId.toPeerId();
const targets = (Array.from(this.tabs[inputFilter].querySelectorAll('.' + targetClassName)) as HTMLElement[]).map(el => {
const containerEl = findUpClassName(el, className);
return {
element: el,
mid: +containerEl.dataset.mid,
- peerId: +containerEl.dataset.peerId
+ peerId: containerEl.dataset.peerId.toPeerId()
};
});
@@ -923,7 +954,7 @@ export default class AppSearchSuper {
}
private loadChats() {
- const renderedPeerIds: Set = new Set();
+ const renderedPeerIds: Set = new Set();
const middleware = this.middleware.get();
for(let i in this.searchGroups) {
@@ -934,7 +965,7 @@ export default class AppSearchSuper {
const query = this.searchContext.query;
if(query) {
- const setResults = (results: number[], group: SearchGroup, showMembersCount = false) => {
+ const setResults = (results: PeerId[], group: SearchGroup, showMembersCount = false) => {
results.forEach((peerId) => {
if(renderedPeerIds.has(peerId)) {
return;
@@ -957,7 +988,7 @@ export default class AppSearchSuper {
if(showMembersCount && (peer.participants_count || peer.participants)) {
const regExp = new RegExp(`(${escapeRegExp(query)}|${escapeRegExp(cleanSearchText(query))})`, 'gi');
dom.titleSpan.innerHTML = dom.titleSpan.innerHTML.replace(regExp, '$1');
- dom.lastMessageSpan.append(appProfileManager.getChatMembersString(-peerId));
+ dom.lastMessageSpan.append(appProfileManager.getChatMembersString(peerId.toChatId()));
} else if(peerId === rootScope.myId) {
dom.lastMessageSpan.append(i18n('Presence.YourChat'));
} else {
@@ -989,7 +1020,7 @@ export default class AppSearchSuper {
};
return Promise.all([
- appUsersManager.getContacts(query, true)
+ appUsersManager.getContactsPeerIds(query, true)
.then(onLoad)
.then((contacts) => {
if(contacts) {
@@ -1050,7 +1081,7 @@ export default class AppSearchSuper {
autonomous: true
});
- dom.lastMessageSpan.append(peerId > 0 ? appUsersManager.getUserStatusString(peerId) : appProfileManager.getChatMembersString(-peerId));
+ dom.lastMessageSpan.append(peerId.isUser() ? appUsersManager.getUserStatusString(peerId) : appProfileManager.getChatMembersString(peerId.toChatId()));
});
if(!state.recentSearch.length) {
@@ -1093,7 +1124,7 @@ export default class AppSearchSuper {
}
private loadMembers(mediaTab: SearchSuperMediaTab) {
- const id = -this.searchContext.peerId;
+ const id = this.searchContext.peerId.toChatId();
const middleware = this.middleware.get();
let promise: Promise;
@@ -1114,7 +1145,7 @@ export default class AppSearchSuper {
return;
}
- const peerId = +li.dataset.peerId;
+ const peerId = li.dataset.peerId.toPeerId();
let promise: Promise = Promise.resolve();
if(mediaSizes.isMobile) {
promise = appSidebarRight.toggleSidebar(false);
@@ -1130,7 +1161,7 @@ export default class AppSearchSuper {
participants.forEach(participant => {
const peerId = appChatsManager.getParticipantPeerId(participant);
- if(peerId < 0) {
+ if(peerId.isAnyChat()) {
return;
}
@@ -1386,7 +1417,7 @@ export default class AppSearchSuper {
return !this.loaded[inputFilter] || (this.historyStorage[inputFilter] && this.usedFromHistory[inputFilter] < this.historyStorage[inputFilter].length);
});
- if(peerId > 0) {
+ if(peerId.isUser()) {
toLoad.findAndSplice(mediaTab => mediaTab.type === 'members');
}
@@ -1456,7 +1487,7 @@ export default class AppSearchSuper {
}
public canViewMembers() {
- return this.searchContext.peerId < 0 && !appChatsManager.isBroadcast(-this.searchContext.peerId) && appChatsManager.hasRights(-this.searchContext.peerId, 'view_participants');
+ return this.searchContext.peerId.isAnyChat() && !appChatsManager.isBroadcast(this.searchContext.peerId.toChatId()) && appChatsManager.hasRights(this.searchContext.peerId.toChatId(), 'view_participants');
}
public cleanup() {
@@ -1566,7 +1597,7 @@ export default class AppSearchSuper {
}
public setQuery({peerId, query, threadId, historyStorage, folderId, minDate, maxDate}: {
- peerId: number,
+ peerId: PeerId,
query?: string,
threadId?: number,
historyStorage?: AppSearchSuper['historyStorage'],
@@ -1575,7 +1606,7 @@ export default class AppSearchSuper {
maxDate?: number
}) {
this.searchContext = {
- peerId: peerId || 0,
+ peerId,
query: query || '',
inputFilter: {_: this.mediaTab.inputFilter},
threadId,
diff --git a/src/components/appSelectPeers.ts b/src/components/appSelectPeers.ts
index 7060344e..112ee5d2 100644
--- a/src/components/appSelectPeers.ts
+++ b/src/components/appSelectPeers.ts
@@ -20,7 +20,7 @@ import findUpClassName from "../helpers/dom/findUpClassName";
import PeerTitle from "./peerTitle";
import { cancelEvent } from "../helpers/dom/cancelEvent";
import replaceContent from "../helpers/dom/replaceContent";
-import { filterUnique } from "../helpers/array";
+import { filterUnique, indexOfAndSplice } from "../helpers/array";
import debounce from "../helpers/schedulers/debounce";
import windowSize from "../helpers/windowSize";
@@ -28,7 +28,6 @@ type PeerType = 'contacts' | 'dialogs' | 'channelParticipants';
// TODO: правильная сортировка для addMembers, т.е. для peerType: 'contacts', потому что там идут сначала контакты - потом неконтакты, а должно всё сортироваться по имени
-let loadedAllDialogs = false, loadAllDialogsPromise: Promise;
export default class AppSelectPeers {
public container = document.createElement('div');
public list = appDialogsManager.createChatList(/* {
@@ -42,8 +41,8 @@ export default class AppSelectPeers {
public selectedContainer: HTMLElement;
public input: HTMLInputElement;
- //public selected: {[peerId: number]: HTMLElement} = {};
- public selected = new Set();
+ //public selected: {[peerId: PeerId]: HTMLElement} = {};
+ public selected = new Set();
public freezed = false;
@@ -52,23 +51,23 @@ export default class AppSelectPeers {
private promise: Promise;
private query = '';
- private cachedContacts: number[];
+ private cachedContacts: PeerId[];
private loadedWhat: Partial<{[k in 'dialogs' | 'archived' | 'contacts' | 'channelParticipants']: true}> = {};
- private renderedPeerIds: Set = new Set();
+ private renderedPeerIds: Set = new Set();
private appendTo: HTMLElement;
private onChange: (length: number) => void;
private peerType: PeerType[] = ['dialogs'];
- private renderResultsFunc: (peerIds: number[]) => void;
+ private renderResultsFunc: (peerIds: PeerId[]) => void;
private chatRightsAction: ChatRights;
private multiSelect = true;
private rippleEnabled = true;
private avatarSize = 48;
private tempIds: {[k in keyof AppSelectPeers['loadedWhat']]: number} = {};
- private peerId = 0;
+ private peerId: PeerId;
private placeholder: LangPackKey;
@@ -95,7 +94,7 @@ export default class AppSelectPeers {
this.container.classList.add('selector');
const f = (this.renderResultsFunc || this.renderResults).bind(this);
- this.renderResultsFunc = (peerIds: number[]) => {
+ this.renderResultsFunc = (peerIds: PeerId[]) => {
if(this.needSwitchList) {
this.scrollable.splitUp.replaceWith(this.list);
this.scrollable.setVirtualContainer(this.list);
@@ -144,7 +143,7 @@ export default class AppSelectPeers {
const peerId = target.dataset.key;
const li = this.chatsContainer.querySelector('[data-peer-id="' + peerId + '"]') as HTMLElement;
if(!li) {
- this.remove(+peerId || peerId);
+ this.remove(peerId.toPeerId());
} else {
li.click();
}
@@ -165,8 +164,8 @@ export default class AppSelectPeers {
if(!target) return;
if(this.freezed) return;
- let key: any = target.dataset.peerId;
- key = +key || key;
+ let key: PeerId | string = target.dataset.peerId;
+ key = key.isPeerId() ? key.toPeerId() : key;
if(!this.multiSelect) {
this.add(key);
@@ -208,7 +207,7 @@ export default class AppSelectPeers {
private onInput = () => {
const value = this.input.value;
if(this.query !== value) {
- if(this.peerType.includes('contacts')) {
+ if(this.peerType.includes('contacts') || this.peerType.includes('dialogs')) {
this.cachedContacts = null;
}
@@ -283,9 +282,9 @@ export default class AppSelectPeers {
this.renderSaved();
this.offsetIndex = newOffsetIndex;
-
- this.renderResultsFunc(dialogs.map(dialog => dialog.peerId));
}
+
+ this.renderResultsFunc(dialogs.map(dialog => dialog.peerId));
if(value.isEnd) {
if(!this.loadedWhat.dialogs) {
@@ -299,18 +298,18 @@ export default class AppSelectPeers {
} else {
this.loadedWhat.archived = true;
- if(!this.loadedWhat.contacts && this.peerType.includes('contacts')) {
+ if(!this.loadedWhat.contacts/* && this.peerType.includes('contacts') */) {
return this.getMoreContacts();
}
}
}
}
- private filterByRights(peerId: number) {
+ private filterByRights(peerId: PeerId) {
return (
- peerId > 0 &&
+ peerId.isUser() &&
(this.chatRightsAction !== 'send_messages' || appUsersManager.canSendToUser(peerId))
- ) || appChatsManager.hasRights(-peerId, this.chatRightsAction);
+ ) || appChatsManager.hasRights(peerId.toChatId(), this.chatRightsAction);
}
private async getMoreContacts() {
@@ -320,6 +319,8 @@ export default class AppSelectPeers {
return;
}
+ const isGlobalSearch = this.peerType.includes('contacts');
+
if(!this.cachedContacts) {
/* const promises: Promise[] = [appUsersManager.getContacts(this.query)];
if(!this.peerType.includes('dialogs')) {
@@ -330,39 +331,40 @@ export default class AppSelectPeers {
this.cachedContacts = (await this.promise)[0].slice(); */
const tempId = this.getTempId('contacts');
const promise = Promise.all([
- appUsersManager.getContacts(this.query),
+ isGlobalSearch ? appUsersManager.getContactsPeerIds(this.query) : [],
this.query ? appUsersManager.searchContacts(this.query) : undefined
]);
this.promise = promise;
- const [cachedContacts, searchResult] = await promise;
+ let [cachedContacts, searchResult] = await promise;
if(this.tempIds.contacts !== tempId) {
return;
}
if(searchResult) {
- let resultPeerIds = searchResult.my_results.concat(searchResult.results);
+ // do not add global result if only dialogs needed
+ let resultPeerIds = isGlobalSearch ? searchResult.my_results.concat(searchResult.results) : searchResult.my_results;
if(this.chatRightsAction) {
resultPeerIds = resultPeerIds.filter(peerId => this.filterByRights(peerId));
}
if(!this.peerType.includes('dialogs')) {
- resultPeerIds = resultPeerIds.filter(peerId => peerId > 0);
+ resultPeerIds = resultPeerIds.filter(peerId => peerId.isUser());
}
this.cachedContacts = filterUnique(cachedContacts.concat(resultPeerIds));
} else this.cachedContacts = cachedContacts.slice();
- this.cachedContacts.findAndSplice(userId => userId === rootScope.myId); // no my account
+ indexOfAndSplice(this.cachedContacts, rootScope.myId); // no my account
this.promise = null;
}
- if(this.cachedContacts.length) {
+ // if(this.cachedContacts.length) {
const pageCount = windowSize.windowH / 72 * 1.25 | 0;
const arr = this.cachedContacts.splice(0, pageCount);
this.renderResultsFunc(arr);
- }
+ // }
if(!this.cachedContacts.length) {
this.loadedWhat.contacts = true;
@@ -384,7 +386,7 @@ export default class AppSelectPeers {
const pageCount = 50; // same as in group permissions to use cache
const tempId = this.getTempId('channelParticipants');
- const promise = appProfileManager.getChannelParticipants(-this.peerId, {_: 'channelParticipantsSearch', q: this.query}, pageCount, this.list.childElementCount);
+ const promise = appProfileManager.getChannelParticipants(this.peerId.toChatId(), {_: 'channelParticipantsSearch', q: this.query}, pageCount, this.list.childElementCount);
const participants = await promise;
if(this.tempIds.channelParticipants !== tempId) {
return;
@@ -393,7 +395,7 @@ export default class AppSelectPeers {
const peerIds = participants.participants.map(participant => {
return appChatsManager.getParticipantPeerId(participant);
});
- peerIds.findAndSplice(u => u === rootScope.myId);
+ indexOfAndSplice(peerIds, rootScope.myId);
this.renderResultsFunc(peerIds);
if(this.list.childElementCount >= participants.count || participants.participants.length < pageCount) {
@@ -409,18 +411,18 @@ export default class AppSelectPeers {
const get = () => {
const promises: Promise[] = [];
- if(!loadedAllDialogs && (this.peerType.includes('dialogs')/* || this.peerType.includes('contacts') */)) {
- if(!loadAllDialogsPromise) {
- loadAllDialogsPromise = appMessagesManager.getConversationsAll()
- .then(() => {
- loadedAllDialogs = true;
- }).finally(() => {
- loadAllDialogsPromise = null;
- });
- }
+ // if(!loadedAllDialogs && (this.peerType.includes('dialogs')/* || this.peerType.includes('contacts') */)) {
+ // if(!loadAllDialogsPromise) {
+ // loadAllDialogsPromise = appMessagesManager.getConversationsAll()
+ // .then(() => {
+ // loadedAllDialogs = true;
+ // }).finally(() => {
+ // loadAllDialogsPromise = null;
+ // });
+ // }
- promises.push(loadAllDialogsPromise);
- }
+ // promises.push(loadAllDialogsPromise);
+ // }
if((this.peerType.includes('dialogs')/* || this.loadedWhat.contacts */) && !this.loadedWhat.archived) { // to load non-contacts
promises.push(this.getMoreDialogs());
@@ -430,7 +432,7 @@ export default class AppSelectPeers {
}
}
- if(this.peerType.includes('contacts') && !this.loadedWhat.contacts) {
+ if((this.peerType.includes('contacts') || this.peerType.includes('dialogs')) && !this.loadedWhat.contacts) {
promises.push(this.getMoreContacts());
}
@@ -450,7 +452,7 @@ export default class AppSelectPeers {
return promise;
}
- private renderResults(peerIds: number[]) {
+ private renderResults(peerIds: PeerId[]) {
//console.log('will renderResults:', peerIds);
// оставим только неконтакты с диалогов
@@ -482,8 +484,8 @@ export default class AppSelectPeers {
}
let subtitleEl: HTMLElement;
- if(peerId < 0) {
- subtitleEl = appProfileManager.getChatMembersString(-peerId);
+ if(peerId.isAnyChat()) {
+ subtitleEl = appProfileManager.getChatMembersString(peerId.toChatId());
} else if(peerId === rootScope.myId) {
subtitleEl = i18n(this.selfPresence);
} else {
@@ -494,9 +496,9 @@ export default class AppSelectPeers {
});
}
- public add(peerId: any, title?: string | HTMLElement, scroll = true) {
+ public add(key: PeerId | string, title?: string | HTMLElement, scroll = true) {
//console.trace('add');
- this.selected.add(peerId);
+ this.selected.add(key);
if(!this.multiSelect) {
this.onChange(this.selected.size);
@@ -516,13 +518,13 @@ export default class AppSelectPeers {
avatarEl.setAttribute('dialog', '1');
avatarEl.classList.add('avatar-32');
- div.dataset.key = '' + peerId;
- if(typeof(peerId) === 'number') {
+ div.dataset.key = '' + key;
+ if(key.isPeerId()) {
if(title === undefined) {
- title = new PeerTitle({peerId, dialog: true}).element;
+ title = new PeerTitle({peerId: key.toPeerId(), dialog: true}).element;
}
- avatarEl.setAttribute('peer', '' + peerId);
+ avatarEl.setAttribute('peer', '' + key);
}
if(title) {
@@ -547,7 +549,7 @@ export default class AppSelectPeers {
return div;
}
- public remove(key: any) {
+ public remove(key: PeerId | string) {
if(!this.multiSelect) return;
//const div = this.selected[peerId];
const div = this.selectedContainer.querySelector(`[data-key="${key}"]`) as HTMLElement;
diff --git a/src/components/audio.ts b/src/components/audio.ts
index 5c9b2458..85b7dd5d 100644
--- a/src/components/audio.ts
+++ b/src/components/audio.ts
@@ -352,7 +352,7 @@ export const findAudioTargets = (anchor: HTMLElement, useSearch: boolean) => {
const elements = Array.from(container.querySelectorAll(selector)) as HTMLElement[];
const idx = elements.indexOf(anchor);
- const mediaItems: MediaItem[] = elements.map(element => ({peerId: +element.dataset.peerId, mid: +element.dataset.mid}));
+ const mediaItems: MediaItem[] = elements.map(element => ({peerId: element.dataset.peerId.toPeerId(), mid: +element.dataset.mid}));
prev = mediaItems.slice(0, idx);
next = mediaItems.slice(idx + 1);
@@ -481,31 +481,31 @@ export default class AudioElement extends HTMLElement {
return togglePlay;
};
+ if(doc.thumbs?.length) {
+ const imgs: HTMLImageElement[] = [];
+ const wrapped = wrapPhoto({
+ photo: doc,
+ message: null,
+ container: toggle,
+ boxWidth: 48,
+ boxHeight: 48,
+ loadPromises: this.loadPromises,
+ withoutPreloader: true,
+ lazyLoadQueue: this.lazyLoadQueue
+ });
+ toggle.style.width = toggle.style.height = '';
+ if(wrapped.images.thumb) imgs.push(wrapped.images.thumb);
+ if(wrapped.images.full) imgs.push(wrapped.images.full);
+
+ this.classList.add('audio-with-thumb');
+ imgs.forEach(img => img.classList.add('audio-thumb'));
+ }
+
if(!isOutgoing) {
let preloader: ProgressivePreloader = this.preloader;
onLoad(doc.type !== 'audio' && !this.noAutoDownload);
- if(doc.thumbs) {
- const imgs: HTMLImageElement[] = [];
- const wrapped = wrapPhoto({
- photo: doc,
- message: null,
- container: toggle,
- boxWidth: 48,
- boxHeight: 48,
- loadPromises: this.loadPromises,
- withoutPreloader: true,
- lazyLoadQueue: this.lazyLoadQueue
- });
- toggle.style.width = toggle.style.height = '';
- if(wrapped.images.thumb) imgs.push(wrapped.images.thumb);
- if(wrapped.images.full) imgs.push(wrapped.images.full);
-
- this.classList.add('audio-with-thumb');
- imgs.forEach(img => img.classList.add('audio-thumb'));
- }
-
const r = (shouldPlay: boolean) => {
if(this.audio.src) {
return;
diff --git a/src/components/avatar.ts b/src/components/avatar.ts
index a282dd97..09f7d256 100644
--- a/src/components/avatar.ts
+++ b/src/components/avatar.ts
@@ -7,7 +7,7 @@
import appMessagesManager from "../lib/appManagers/appMessagesManager";
import appProfileManager from "../lib/appManagers/appProfileManager";
import rootScope from "../lib/rootScope";
-import { Message } from "../layer";
+import { Message, Photo } from "../layer";
import appPeersManager from "../lib/appManagers/appPeersManager";
import appPhotosManager from "../lib/appManagers/appPhotosManager";
import type { LazyLoadQueueIntersector } from "./lazyLoadQueue";
@@ -16,8 +16,9 @@ import { cancelEvent } from "../helpers/dom/cancelEvent";
import appAvatarsManager from "../lib/appManagers/appAvatarsManager";
import AppMediaViewer from "./appMediaViewer";
import AppMediaViewerAvatar from "./appMediaViewerAvatar";
+import { NULL_PEER_ID } from "../lib/mtproto/mtproto_config";
-const onAvatarUpdate = (peerId: number) => {
+const onAvatarUpdate = (peerId: PeerId) => {
appAvatarsManager.removeFromAvatarsCache(peerId);
(Array.from(document.querySelectorAll('avatar-element[peer="' + peerId + '"]')) as AvatarElement[]).forEach(elem => {
//console.log('updating avatar:', elem);
@@ -32,7 +33,14 @@ rootScope.addEventListener('peer_title_edit', (peerId) => {
}
});
-export async function openAvatarViewer(target: HTMLElement, peerId: number, middleware: () => boolean, message?: any, prevTargets?: {element: HTMLElement, item: string | Message.messageService}[], nextTargets?: typeof prevTargets) {
+export async function openAvatarViewer(
+ target: HTMLElement,
+ peerId: PeerId,
+ middleware: () => boolean,
+ message?: any,
+ prevTargets?: {element: HTMLElement, item: Photo.photo['id'] | Message.messageService}[],
+ nextTargets?: typeof prevTargets
+) {
let photo = await appProfileManager.getFullPhoto(peerId);
if(!middleware() || !photo) {
return;
@@ -43,7 +51,7 @@ export async function openAvatarViewer(target: HTMLElement, peerId: number, midd
return good ? target : null;
};
- if(peerId < 0) {
+ if(peerId.isAnyChat()) {
const hadMessage = !!message;
const inputFilter = 'inputMessagesFilterChatPhotos';
if(!message) {
@@ -105,11 +113,11 @@ export async function openAvatarViewer(target: HTMLElement, peerId: number, midd
}
}
-const believeMe: Map> = new Map();
-const seen: Set = new Set();
+const believeMe: Map> = new Map();
+const seen: Set = new Set();
export default class AvatarElement extends HTMLElement {
- private peerId: number;
+ private peerId: PeerId;
private isDialog = false;
private peerTitle: string;
public loadPromises: Promise[];
@@ -160,13 +168,14 @@ export default class AvatarElement extends HTMLElement {
//console.log('avatar changed attribute:', name, oldValue, newValue);
// вызывается при изменении одного из перечисленных выше атрибутов
if(name === 'peer') {
- if(this.peerId === +newValue) {
+ const newPeerId = (newValue || '').toPeerId() || NULL_PEER_ID;
+ if(this.peerId === newPeerId) {
return;
}
- this.peerId = appPeersManager.getPeerMigratedTo(+newValue) || +newValue;
+ this.peerId = appPeersManager.getPeerMigratedTo(newPeerId) || newPeerId;
- const wasPeerId = +oldValue;
+ const wasPeerId = (oldValue || '').toPeerId() || NULL_PEER_ID;
if(wasPeerId) {
const set = believeMe.get(wasPeerId);
if(set) {
diff --git a/src/components/chat/autocompletePeerHelper.ts b/src/components/chat/autocompletePeerHelper.ts
index 6d80c1a8..909cd618 100644
--- a/src/components/chat/autocompletePeerHelper.ts
+++ b/src/components/chat/autocompletePeerHelper.ts
@@ -42,7 +42,7 @@ export default class AutocompletePeerHelper extends AutocompleteHelper {
});
}
- public render(data: {peerId: number, name?: string, description?: string}[]) {
+ public render(data: {peerId: PeerId, name?: string, description?: string}[]) {
if(this.init) {
if(!data.length) {
return;
@@ -71,7 +71,7 @@ export default class AutocompletePeerHelper extends AutocompleteHelper {
public static listElement(options: {
className: string,
- peerId: number,
+ peerId: PeerId,
name?: string,
description?: string
}) {
diff --git a/src/components/chat/bubbleGroups.ts b/src/components/chat/bubbleGroups.ts
index 8f6d6c17..0a7a22bc 100644
--- a/src/components/chat/bubbleGroups.ts
+++ b/src/components/chat/bubbleGroups.ts
@@ -8,9 +8,10 @@ import rootScope from "../../lib/rootScope";
//import { generatePathData } from "../../helpers/dom";
import { MyMessage } from "../../lib/appManagers/appMessagesManager";
import type Chat from "./chat";
+import { indexOfAndSplice } from "../../helpers/array";
type Group = {bubble: HTMLElement, mid: number, timestamp: number}[];
-type BubbleGroup = {timestamp: number, fromId: number, mid: number, group: Group};
+type BubbleGroup = {timestamp: number, fromId: PeerId, mid: number, group: Group};
export default class BubbleGroups {
private bubbles: Array = []; // map to group
private detailsMap: Map = new Map();
@@ -28,7 +29,7 @@ export default class BubbleGroups {
if(details.group.length) {
details.group.findAndSplice(d => d.bubble === bubble);
if(!details.group.length) {
- this.groups.findAndSplice(g => g === details.group);
+ indexOfAndSplice(this.groups, details.group);
} else {
this.updateGroup(details.group);
}
@@ -37,6 +38,13 @@ export default class BubbleGroups {
this.detailsMap.delete(bubble);
}
}
+
+ changeBubbleMid(bubble: HTMLElement, mid: number) {
+ const details = this.detailsMap.get(bubble);
+ if(details) {
+ details.mid = mid;
+ }
+ }
addBubble(bubble: HTMLElement, message: MyMessage, reverse: boolean) {
//return;
@@ -48,7 +56,7 @@ export default class BubbleGroups {
// fix for saved messages forward to self
if(fromId === rootScope.myId && message.peerId === rootScope.myId && (message as any).fwdFromId === fromId) {
- fromId = -fromId;
+ fromId = fromId.toPeerId(true);
}
// try to find added
diff --git a/src/components/chat/bubbles.ts b/src/components/chat/bubbles.ts
index 5a22f138..e8e02222 100644
--- a/src/components/chat/bubbles.ts
+++ b/src/components/chat/bubbles.ts
@@ -20,7 +20,7 @@ import { CHAT_ANIMATION_GROUP } from "../../lib/appManagers/appImManager";
import { getObjectKeysAndSort } from "../../helpers/object";
import { IS_TOUCH_SUPPORTED } from "../../environment/touchSupport";
import { logger } from "../../lib/logger";
-import rootScope, { BroadcastEvents } from "../../lib/rootScope";
+import rootScope from "../../lib/rootScope";
import BubbleGroups from "./bubbleGroups";
import PopupDatePicker from "../popups/datePicker";
import PopupForward from "../popups/forward";
@@ -75,6 +75,9 @@ import { SEND_WHEN_ONLINE_TIMESTAMP } from "../../lib/mtproto/constants";
import windowSize from "../../helpers/windowSize";
import { formatPhoneNumber } from "../../helpers/formatPhoneNumber";
import AppMediaViewer from "../appMediaViewer";
+import SetTransition from "../singleTransition";
+import handleHorizontalSwipe from "../../helpers/dom/handleHorizontalSwipe";
+import { cancelContextMenuOpening } from "../misc";
const USE_MEDIA_TAILS = false;
const IGNORE_ACTIONS: Set = new Set([
@@ -98,11 +101,11 @@ export default class ChatBubbles {
private getHistoryTopPromise: Promise;
private getHistoryBottomPromise: Promise;
- public peerId = 0;
+ public peerId: PeerId;
//public messagesCount: number = -1;
private unreadOut = new Set();
- public needUpdate: {replyToPeerId: number, replyMid: number, mid: number}[] = []; // if need wrapSingleMessage
+ public needUpdate: {replyToPeerId: PeerId, replyMid: number, mid: number}[] = []; // if need wrapSingleMessage
public bubbles: {[mid: string]: HTMLDivElement} = {};
public skippedMids: Set = new Set();
@@ -170,7 +173,8 @@ export default class ChatBubbles {
private viewsMids: Set = new Set();
private sendViewCountersDebounced: () => Promise;
- constructor(private chat: Chat,
+ constructor(
+ private chat: Chat,
private appMessagesManager: AppMessagesManager,
private appStickersManager: AppStickersManager,
private appUsersManager: AppUsersManager,
@@ -216,7 +220,7 @@ export default class ChatBubbles {
const message = this.chat.getMessage(mid);
if(+bubble.dataset.timestamp >= (message.date + serverTimeManager.serverTimeOffset - 1)) {
- //this.bubbleGroups.addBubble(bubble, message, false); // ! TEMP COMMENTED
+ this.bubbleGroups.changeBubbleMid(bubble, mid);
return;
}
@@ -266,10 +270,18 @@ export default class ChatBubbles {
}
}
- if(message.media?.document && !message.media.document.type) {
+ if(message.media?.document) {
const div = bubble.querySelector(`.document-container[data-mid="${tempId}"] .document`);
if(div) {
- div.replaceWith(wrapDocument({message}));
+ const container = findUpClassName(div, 'document-container');
+
+ if(!tempMessage.media?.document?.thumbs?.length && message.media.document.thumbs?.length) {
+ div.replaceWith(wrapDocument({message}));
+ }
+
+ if(container) {
+ container.dataset.mid = '' + mid;
+ }
}
}
@@ -434,6 +446,74 @@ export default class ChatBubbles {
// attachClickEvent(this.bubblesContainer, this.onBubblesClick, {listenerSetter: this.listenerSetter});
this.listenerSetter.add(this.bubblesContainer)('click', this.onBubblesClick/* , {capture: true, passive: false} */);
+ if(IS_TOUCH_SUPPORTED) {
+ const className = 'is-gesturing-reply';
+ const MAX = 64;
+ const replyAfter = MAX * .75;
+ let shouldReply = false;
+ let target: HTMLElement;
+ let icon: HTMLElement;
+ handleHorizontalSwipe({
+ element: this.bubblesContainer,
+ verifyTouchTarget: (e) => {
+ if(this.chat.selection.isSelecting || !this.appMessagesManager.canSendToPeer(this.peerId, this.chat.threadId)) {
+ return false;
+ }
+
+ // cancelEvent(e);
+ target = findUpClassName(e.target, 'bubble');
+ if(target) {
+ SetTransition(target, className, true, 250);
+ void target.offsetLeft; // reflow
+
+ if(!icon) {
+ icon = document.createElement('span');
+ icon.classList.add('tgico-reply_filled', 'bubble-gesture-reply-icon');
+ } else {
+ icon.classList.remove('is-visible');
+ icon.style.opacity = '';
+ }
+
+ target/* .querySelector('.bubble-content') */.append(icon);
+ }
+
+ return !!target;
+ },
+ onSwipe: (xDiff, yDiff) => {
+ shouldReply = xDiff >= replyAfter;
+
+ if(shouldReply && !icon.classList.contains('is-visible')) {
+ icon.classList.add('is-visible');
+ }
+ icon.style.opacity = '' + Math.min(1, xDiff / replyAfter);
+
+ const x = -Math.max(0, Math.min(MAX, xDiff));
+ target.style.transform = `translateX(${x}px)`;
+ cancelContextMenuOpening();
+ },
+ onReset: () => {
+ const _target = target;
+ SetTransition(_target, className, false, 250, () => {
+ if(icon.parentElement === _target) {
+ icon.classList.remove('is-visible');
+ icon.remove();
+ }
+ });
+
+ fastRaf(() => {
+ _target.style.transform = ``;
+
+ if(shouldReply) {
+ const {mid} = _target.dataset;
+ this.chat.input.initMessageReply(+mid);
+ shouldReply = false;
+ }
+ });
+ },
+ listenerOptions: {capture: true}
+ });
+ }
+
if(DEBUG) {
this.listenerSetter.add(this.bubblesContainer)('dblclick', (e) => {
const bubble = findUpClassName(e.target, 'grouped-item') || findUpClassName(e.target, 'bubble');
@@ -540,7 +620,7 @@ export default class ChatBubbles {
});
this.listenerSetter.add(rootScope)('chat_update', (chatId) => {
- if(this.peerId === -chatId) {
+ if(this.peerId === chatId.toPeerId(true)) {
const hadRights = this.chatInner.classList.contains('has-rights');
const hasRights = this.appMessagesManager.canSendToPeer(this.peerId, this.chat.threadId);
@@ -551,7 +631,7 @@ export default class ChatBubbles {
}
});
- this.listenerSetter.add(rootScope)('settings_updated', (e: BroadcastEvents['settings_updated']) => {
+ this.listenerSetter.add(rootScope)('settings_updated', (e) => {
if(e.key === 'settings.emoji.big') {
const isScrolledDown = this.scrollable.isScrolledDown;
if(!isScrolledDown) {
@@ -872,7 +952,7 @@ export default class ChatBubbles {
const contactDiv: HTMLElement = findUpClassName(target, 'contact');
if(contactDiv) {
- this.chat.appImManager.setInnerPeer(+contactDiv.dataset.peerId);
+ this.chat.appImManager.setInnerPeer(contactDiv.dataset.peerId.toPeerId());
return;
}
@@ -890,7 +970,7 @@ export default class ChatBubbles {
const replies = message.replies;
if(replies) {
this.appMessagesManager.getDiscussionMessage(this.peerId, message.mid).then(message => {
- this.chat.appImManager.setInnerPeer(-replies.channel_id, undefined, 'discussion', (message as MyMessage).mid);
+ this.chat.appImManager.setInnerPeer(replies.channel_id.toPeerId(true), undefined, 'discussion', (message as MyMessage).mid);
});
}
}
@@ -901,21 +981,19 @@ export default class ChatBubbles {
const nameDiv = findUpClassName(target, 'peer-title') || findUpClassName(target, 'name') || findUpTag(target, 'AVATAR-ELEMENT');
if(nameDiv) {
target = nameDiv || target;
- const peerId = +(target.dataset.peerId || target.getAttribute('peer'));
+ const peerId = (target.dataset.peerId || target.getAttribute('peer'));
const savedFrom = target.dataset.savedFrom;
if(nameDiv.classList.contains('is-via')) {
const message = '@' + this.appUsersManager.getUser(peerId).username + ' ';
this.appDraftsManager.setDraft(this.peerId, this.chat.threadId, message);
cancelEvent(e);
} else if(savedFrom) {
- const splitted = savedFrom.split('_');
- const peerId = +splitted[0];
- const msgId = +splitted[1];
+ const [peerId, mid] = savedFrom.split('_');
- this.chat.appImManager.setInnerPeer(peerId, msgId);
+ this.chat.appImManager.setInnerPeer(peerId.toPeerId(), +mid);
} else {
if(peerId) {
- this.chat.appImManager.setInnerPeer(peerId);
+ this.chat.appImManager.setInnerPeer(peerId.toPeerId());
} else {
toast(I18n.format('HidAccount', true));
}
@@ -967,7 +1045,7 @@ export default class ChatBubbles {
return media._ === 'photo' || ['video', 'gif'].includes(media.type);
};
- const targets: {element: HTMLElement, mid: number, peerId: number}[] = [];
+ const targets: {element: HTMLElement, mid: number, peerId: PeerId}[] = [];
const ids = Object.keys(this.bubbles).map(k => +k).filter(id => {
//if(!this.scrollable.visibleElements.find(e => e.element === this.bubbles[id])) return false;
@@ -1051,11 +1129,9 @@ export default class ChatBubbles {
if(['DIV', 'SPAN'].indexOf(target.tagName) !== -1/* || target.tagName === 'A' */) {
if(target.classList.contains('goto-original')) {
const savedFrom = bubble.dataset.savedFrom;
- const splitted = savedFrom.split('_');
- const peerId = +splitted[0];
- const msgId = +splitted[1];
+ const [peerId, mid] = savedFrom.split('_');
////this.log('savedFrom', peerId, msgID);
- this.chat.appImManager.setInnerPeer(peerId, msgId);
+ this.chat.appImManager.setInnerPeer(peerId.toPeerId(), +mid);
return;
} else if(target.classList.contains('forward')) {
const mid = +bubble.dataset.mid;
@@ -1681,13 +1757,13 @@ export default class ChatBubbles {
////console.timeEnd('appImManager cleanup');
}
- public setPeer(peerId: number, lastMsgId?: number): {cached?: boolean, promise: Chat['setPeerPromise']} {
+ public setPeer(peerId: PeerId, lastMsgId?: number): {cached?: boolean, promise: Chat['setPeerPromise']} {
//console.time('appImManager setPeer');
//console.time('appImManager setPeer pre promise');
////console.time('appImManager: pre render start');
if(!peerId) {
this.cleanup(true);
- this.peerId = 0;
+ this.peerId = peerId;
return null;
}
@@ -2186,6 +2262,10 @@ export default class ChatBubbles {
bubble.className = classNames.join(' ');
contentWrapper = bubble.lastElementChild as HTMLElement;
+ if(!contentWrapper.classList.contains('bubble-content-wrapper')) {
+ contentWrapper = bubble.querySelector('.bubble-content-wrapper');
+ }
+
bubbleContainer = contentWrapper.firstElementChild as HTMLDivElement;
bubbleContainer.innerHTML = '';
bubbleContainer.style.cssText = '';
@@ -2242,9 +2322,9 @@ export default class ChatBubbles {
s.classList.add('service-msg');
if(action) {
if(action._ === 'messageActionChannelMigrateFrom') {
- s.append(i18n('ChatMigration.From', [new PeerTitle({peerId: -action.chat_id}).element]));
+ s.append(i18n('ChatMigration.From', [new PeerTitle({peerId: action.chat_id.toPeerId(true)}).element]));
} else if(action._ === 'messageActionChatMigrateTo') {
- s.append(i18n('ChatMigration.To', [new PeerTitle({peerId: -action.channel_id}).element]));
+ s.append(i18n('ChatMigration.To', [new PeerTitle({peerId: action.channel_id.toPeerId(true)}).element]));
} else {
s.append(this.appMessagesManager.wrapMessageActionTextNew(message));
}
@@ -2376,28 +2456,19 @@ export default class ChatBubbles {
case 'keyboardButtonSwitchInline': {
buttonEl = document.createElement('button');
- buttonEl.classList.add('is-switch-inline'/* , 'tgico' */);
- const i = document.createElement('i');
- i.classList.add('forward-icon');
- i.innerHTML = ``;
- buttonEl.append(i);
+ buttonEl.classList.add('is-switch-inline', 'tgico');
attachClickEvent(buttonEl, (e) => {
cancelEvent(e);
const botId = message.viaBotId || message.fromId;
- let promise: Promise;
+ let promise: Promise;
if(button.pFlags.same_peer) promise = Promise.resolve(this.peerId);
else promise = this.appInlineBotsManager.checkSwitchReturn(botId).then(peerId => {
if(peerId) {
return peerId;
}
- return new Promise((resolve, reject) => {
+ return new Promise((resolve, reject) => {
new PopupForward({
[this.peerId]: []
}, (peerId) => {
@@ -2883,8 +2954,8 @@ export default class ChatBubbles {
let savedFrom = '';
- // const needName = ((peerId < 0 && (peerId !== message.fromId || our)) && message.fromId !== rootScope.myId) || message.viaBotId;
- const needName = (message.fromId !== rootScope.myId && peerId < 0 && !this.appPeersManager.isBroadcast(peerId)) || message.viaBotId;
+ // const needName = ((peerId.isAnyChat() && (peerId !== message.fromId || our)) && message.fromId !== rootScope.myId) || message.viaBotId;
+ const needName = (message.fromId !== rootScope.myId && this.appPeersManager.isAnyChat(peerId) && !this.appPeersManager.isBroadcast(peerId)) || message.viaBotId;
if(needName || message.fwd_from || message.reply_to_mid) { // chat
let title: HTMLElement | DocumentFragment;
@@ -3498,12 +3569,12 @@ export default class ChatBubbles {
elements.push(b, '\n\n');
} else if(this.appPeersManager.isAnyGroup(this.peerId) && this.appPeersManager.getPeer(this.peerId).pFlags.creator) {
this.renderEmptyPlaceholder('group', bubble, message, elements);
- } else if(rootScope.myId === this.peerId) {
- this.renderEmptyPlaceholder('saved', bubble, message, elements);
- } else if(this.peerId > 0 && !isBot && this.appMessagesManager.canSendToPeer(this.peerId) && this.chat.type === 'chat') {
- this.renderEmptyPlaceholder('greeting', bubble, message, elements);
} else if(this.chat.type === 'scheduled') {
this.renderEmptyPlaceholder('noScheduledMessages', bubble, message, elements);
+ } else if(rootScope.myId === this.peerId) {
+ this.renderEmptyPlaceholder('saved', bubble, message, elements);
+ } else if(this.appPeersManager.isUser(this.peerId) && !isBot && this.appMessagesManager.canSendToPeer(this.peerId) && this.chat.type === 'chat') {
+ this.renderEmptyPlaceholder('greeting', bubble, message, elements);
} else {
this.renderEmptyPlaceholder('noMessages', bubble, message, elements);
}
@@ -3537,7 +3608,7 @@ export default class ChatBubbles {
const message: Omit & {message?: string} = {
_: service ? 'messageService' : 'message',
date: 0,
- id: -(this.peerId + offset),
+ id: -(+this.peerId + offset),
peer_id: this.appPeersManager.getOutputPeer(this.peerId),
pFlags: {}
};
@@ -3566,11 +3637,11 @@ export default class ChatBubbles {
return;
} */
- if(side === 'top' && value && this.appUsersManager.isBot(this.peerId)) {
+ if(side === 'top' && value && this.appPeersManager.isBot(this.peerId)) {
this.log('inject bot description');
const middleware = this.getMiddleware();
- return this.appProfileManager.getProfile(this.peerId).then(userFull => {
+ return this.appProfileManager.getProfile(this.peerId.toUserId()).then(userFull => {
if(!middleware()) {
return;
}
diff --git a/src/components/chat/chat.ts b/src/components/chat/chat.ts
index ad43b509..3424b5b2 100644
--- a/src/components/chat/chat.ts
+++ b/src/components/chat/chat.ts
@@ -33,7 +33,7 @@ import ChatContextMenu from "./contextMenu";
import ChatInput from "./input";
import ChatSelection from "./selection";
import ChatTopbar from "./topbar";
-import { REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config";
+import { NULL_PEER_ID, REPLIES_PEER_ID } from "../../lib/mtproto/mtproto_config";
import SetTransition from "../singleTransition";
import { fastRaf } from "../../helpers/schedulers";
import AppPrivateSearchTab from "../sidebarRight/tabs/search";
@@ -57,7 +57,7 @@ export default class Chat extends EventListenerBase<{
public wasAlreadyUsed = false;
// public initPeerId = 0;
- public peerId = 0;
+ public peerId: PeerId;
public threadId: number;
public setPeerPromise: Promise;
public peerChanged: boolean;
@@ -170,7 +170,7 @@ export default class Chat extends EventListenerBase<{
}
}
- public init(/* peerId: number */) {
+ public init(/* peerId: PeerId */) {
// this.initPeerId = peerId;
this.topbar = new ChatTopbar(this, appSidebarRight, this.appMessagesManager, this.appPeersManager, this.appChatsManager, this.appNotificationsManager, this.appProfileManager, this.appUsersManager);
@@ -217,7 +217,7 @@ export default class Chat extends EventListenerBase<{
this.bubbles.listenerSetter.add(rootScope)('dialog_drop', (e) => {
if(e.peerId === this.peerId) {
- this.appImManager.setPeer(0);
+ this.appImManager.setPeer(NULL_PEER_ID);
}
});
}
@@ -249,7 +249,7 @@ export default class Chat extends EventListenerBase<{
this.selection.cleanup();
}
- public setPeer(peerId: number, lastMsgId?: number) {
+ public setPeer(peerId: PeerId, lastMsgId?: number) {
if(!peerId) {
this.inited = false;
} else if(!this.inited) {
@@ -324,15 +324,21 @@ export default class Chat extends EventListenerBase<{
}
public setAutoDownloadMedia() {
+ const peerId = this.peerId;
+ if(!peerId) {
+ return;
+ }
+
let type: keyof State['settings']['autoDownload'];
- if(this.peerId < 0) {
- if(this.appPeersManager.isBroadcast(this.peerId)) {
+
+ if(!peerId.isUser()) {
+ if(peerId.isBroadcast()) {
type = 'channels';
} else {
type = 'groups';
}
} else {
- if(this.appUsersManager.isContact(this.peerId)) {
+ if(peerId.isContact()) {
type = 'contacts';
} else {
type = 'private';
diff --git a/src/components/chat/commandsHelper.ts b/src/components/chat/commandsHelper.ts
index 14591a73..039c61a7 100644
--- a/src/components/chat/commandsHelper.ts
+++ b/src/components/chat/commandsHelper.ts
@@ -31,7 +31,7 @@ export default class CommandsHelper extends AutocompletePeerHelper {
);
}
- public checkQuery(query: string, peerId: number) {
+ public checkQuery(query: string, peerId: PeerId) {
if(!this.appUsersManager.isBot(peerId)) {
return false;
}
@@ -47,12 +47,12 @@ export default class CommandsHelper extends AutocompletePeerHelper {
ignoreCase: true
});
- const commands: Map = new Map();
+ const commands: Map = new Map();
botInfos.forEach(botInfo => {
botInfo.commands.forEach(botCommand => {
const c = '/' + botCommand.command;
commands.set(botCommand.command, {
- peerId: botInfo.user_id,
+ peerId: botInfo.user_id.toPeerId(false),
name: c,
description: botCommand.description
});
diff --git a/src/components/chat/contextMenu.ts b/src/components/chat/contextMenu.ts
index 83a57330..551ddaae 100644
--- a/src/components/chat/contextMenu.ts
+++ b/src/components/chat/contextMenu.ts
@@ -6,7 +6,7 @@
import type { AppMessagesManager } from "../../lib/appManagers/appMessagesManager";
import type { AppPeersManager } from "../../lib/appManagers/appPeersManager";
-import type { AppPollsManager, Poll } from "../../lib/appManagers/appPollsManager";
+import type { AppPollsManager } from "../../lib/appManagers/appPollsManager";
import type { AppDocsManager, MyDocument } from "../../lib/appManagers/appDocsManager";
import type { AppMessagesIdsManager } from "../../lib/appManagers/appMessagesIdsManager";
import type Chat from "./chat";
@@ -24,7 +24,7 @@ import findUpClassName from "../../helpers/dom/findUpClassName";
import { cancelEvent } from "../../helpers/dom/cancelEvent";
import { attachClickEvent, simulateClickEvent } from "../../helpers/dom/clickEvent";
import isSelectionEmpty from "../../helpers/dom/isSelectionEmpty";
-import { Message } from "../../layer";
+import { Message, Poll } from "../../layer";
import PopupReportMessages from "../popups/reportMessages";
export default class ChatContextMenu {
@@ -38,7 +38,7 @@ export default class ChatContextMenu {
private isTextSelected: boolean;
private isAnchorTarget: boolean;
private isUsernameTarget: boolean;
- private peerId: number;
+ private peerId: PeerId;
private mid: number;
private message: any;
@@ -130,7 +130,8 @@ export default class ChatContextMenu {
//appImManager.log('contextmenu', e, bubble, side);
positionMenu((e as TouchEvent).touches ? (e as TouchEvent).touches[0] : e as MouseEvent, this.element, side);
openBtnMenu(this.element, () => {
- this.peerId = this.mid = 0;
+ this.mid = 0;
+ this.peerId = undefined;
this.target = null;
});
};
@@ -417,7 +418,7 @@ export default class ChatContextMenu {
if(threadMessage) url += '?comment=' + msgId;
key = 'LinkCopied';
} else {
- url += 'c/' + Math.abs(this.peerId) + '/' + msgId;
+ url += 'c/' + this.peerId.toChatId() + '/' + msgId;
if(threadMessage) url += '?thread=' + this.appMessagesIdsManager.getServerMessageId(threadMessage.mid);
key = 'LinkCopiedPrivateInfo';
}
diff --git a/src/components/chat/inlineHelper.ts b/src/components/chat/inlineHelper.ts
index 016f7f54..1721d183 100644
--- a/src/components/chat/inlineHelper.ts
+++ b/src/components/chat/inlineHelper.ts
@@ -35,7 +35,7 @@ export default class InlineHelper extends AutocompleteHelper {
private gifsMasonry: GifsMasonry;
private superStickerRenderer: SuperStickerRenderer;
private onChangeScreen: () => void;
- public checkQuery: (peerId: number, username: string, query: string) => ReturnType;
+ public checkQuery: (peerId: PeerId, username: string, query: string) => ReturnType;
constructor(appendTo: HTMLElement,
controller: AutocompleteHelperController,
@@ -50,7 +50,7 @@ export default class InlineHelper extends AutocompleteHelper {
const {peerId, botId, queryId} = this.list.dataset;
return this.chat.input.getReadyToSend(() => {
const queryAndResultIds = this.appInlineBotsManager.generateQId(queryId, (target as HTMLElement).dataset.resultId);
- this.appInlineBotsManager.sendInlineResult(+peerId, +botId, queryAndResultIds, {
+ this.appInlineBotsManager.sendInlineResult(peerId.toPeerId(), botId, queryAndResultIds, {
clearDraft: true,
scheduleDate: this.chat.input.scheduleDate,
silent: this.chat.input.sendSilent,
@@ -80,7 +80,7 @@ export default class InlineHelper extends AutocompleteHelper {
});
}
- public _checkQuery = async(peerId: number, username: string, query: string) => {
+ public _checkQuery = async(peerId: PeerId, username: string, query: string) => {
const middleware = this.controller.getMiddleware();
const peer = await this.appUsersManager.resolveUsername(username);
@@ -105,7 +105,7 @@ export default class InlineHelper extends AutocompleteHelper {
const list = this.list.cloneNode() as HTMLElement;
list.dataset.peerId = '' + peerId;
list.dataset.botId = '' + peer.id;
- list.dataset.queryId = botResults.query_id;
+ list.dataset.queryId = '' + botResults.query_id;
const gifsMasonry = new GifsMasonry(null, ANIMATION_GROUP, this.scrollable, false);
diff --git a/src/components/chat/input.ts b/src/components/chat/input.ts
index f844d564..595c5774 100644
--- a/src/components/chat/input.ts
+++ b/src/components/chat/input.ts
@@ -81,6 +81,8 @@ import { copy } from '../../helpers/object';
import PopupPeer from '../popups/peer';
import MEDIA_MIME_TYPES_SUPPORTED from '../../environment/mediaMimeTypesSupport';
import appMediaPlaybackController from '../appMediaPlaybackController';
+import { NULL_PEER_ID } from '../../lib/mtproto/mtproto_config';
+import replaceContent from '../../helpers/dom/replaceContent';
const RECORD_MIN_TIME = 500;
const POSTING_MEDIA_NOT_ALLOWED = 'Posting media content isn\'t allowed in this group.';
@@ -110,20 +112,22 @@ export default class ChatInput {
private replyKeyboard: ReplyKeyboard;
private attachMenu: HTMLButtonElement;
- private attachMenuButtons: (ButtonMenuItemOptions & {verify: (peerId: number, threadId: number) => boolean})[];
+ private attachMenuButtons: (ButtonMenuItemOptions & {verify: (peerId: PeerId, threadId: number) => boolean})[];
private sendMenu: SendMenu;
private replyElements: {
container: HTMLElement,
- cancelBtn: HTMLButtonElement
+ cancelBtn: HTMLButtonElement,
+ iconBtn: HTMLButtonElement
} = {} as any;
private getWebPagePromise: Promise;
private willSendWebPage: WebPage = null;
- private forwarding: {[fromPeerId: number]: number[]};
+ private forwarding: {[frompeerId: PeerId]: number[]};
public replyToMsgId: number;
public editMsgId: number;
+ public editMessage: Message.message;
private noWebPage: true;
public scheduleDate: number;
public sendSilent: true;
@@ -301,9 +305,10 @@ export default class ChatInput {
this.replyElements.container = document.createElement('div');
this.replyElements.container.classList.add('reply-wrapper');
- this.replyElements.cancelBtn = ButtonIcon('close reply-cancel');
+ this.replyElements.iconBtn = ButtonIcon('');
+ this.replyElements.cancelBtn = ButtonIcon('close reply-cancel', {noRipple: true});
- this.replyElements.container.append(this.replyElements.cancelBtn);
+ this.replyElements.container.append(this.replyElements.iconBtn, this.replyElements.cancelBtn);
this.newMessageWrapper = document.createElement('div');
this.newMessageWrapper.classList.add('new-message-wrapper');
@@ -392,7 +397,7 @@ export default class ChatInput {
onClick: () => {
new PopupCreatePoll(this.chat).show();
},
- verify: (peerId, threadId) => peerId < 0 && this.appMessagesManager.canSendToPeer(peerId, threadId, 'send_polls')
+ verify: (peerId, threadId) => peerId.isAnyChat() && this.appMessagesManager.canSendToPeer(peerId, threadId, 'send_polls')
}];
this.attachMenu = ButtonMenuToggle({noRipple: true, listenerSetter: this.listenerSetter}, 'top-left', this.attachMenuButtons);
@@ -649,7 +654,7 @@ export default class ChatInput {
const peerId = this.chat.peerId;
new PopupPinMessage(peerId, 0, true, () => {
- this.chat.appImManager.setPeer(0); // * close tab
+ this.chat.appImManager.setPeer(NULL_PEER_ID); // * close tab
// ! костыль, это скроет закреплённые сообщения сразу, вместо того, чтобы ждать пока анимация перехода закончится
const originalChat = this.chat.appImManager.chat;
@@ -690,7 +695,7 @@ export default class ChatInput {
}
public scheduleSending = (callback: () => void = this.sendMessage.bind(this, true), initDate = new Date()) => {
- const canSendWhenOnline = this.chat.peerId > 0 && this.appUsersManager.isUserOnlineVisible(this.chat.peerId);
+ const canSendWhenOnline = rootScope.myId !== this.chat.peerId && this.chat.peerId.isUser() && this.appUsersManager.isUserOnlineVisible(this.chat.peerId);
new PopupSchedule(initDate, (timestamp) => {
const minTimestamp = (Date.now() / 1000 | 0) + 10;
@@ -777,7 +782,10 @@ export default class ChatInput {
if(this.messageInputField.value === draft.rMessage && this.replyToMsgId === draft.reply_to_msg_id) return false;
- this.clearHelper();
+ if(fromUpdate) {
+ this.clearHelper();
+ }
+
this.noWebPage = draft.pFlags.no_webpage;
if(draft.reply_to_msg_id) {
this.initMessageReply(draft.reply_to_msg_id);
@@ -1195,7 +1203,7 @@ export default class ChatInput {
this.undoHistory.length = 0;
}
- const urlEntities: Array = entities.filter(e => e._ === 'messageEntityUrl' || e._ === 'messageEntityTextUrl') as any;
+ const urlEntities: Array = !this.editMessage?.media && entities.filter(e => e._ === 'messageEntityUrl' || e._ === 'messageEntityTextUrl') as any;
if(urlEntities.length) {
for(const entity of urlEntities) {
let url: string;
@@ -1376,7 +1384,7 @@ export default class ChatInput {
this.stickersHelper.checkEmoticon(value);
} else if(firstChar === '@') { // mentions
const topMsgId = this.chat.threadId ? this.appMessagesIdsManager.getServerMessageId(this.chat.threadId) : undefined;
- if(this.mentionsHelper.checkQuery(query, this.chat.peerId > 0 ? 0 : this.chat.peerId, topMsgId)) {
+ if(this.mentionsHelper.checkQuery(query, this.chat.peerId.isUser() ? NULL_PEER_ID : this.chat.peerId, topMsgId)) {
foundHelper = this.mentionsHelper;
}
} else if(!matches[1] && firstChar === '/') { // commands
@@ -1456,7 +1464,7 @@ export default class ChatInput {
this.sendMessage();
}
} else {
- if(this.chat.peerId < 0 && !this.appMessagesManager.canSendToPeer(this.chat.peerId, this.chat.threadId, 'send_media')) {
+ if(this.chat.peerId.isAnyChat() && !this.appMessagesManager.canSendToPeer(this.chat.peerId, this.chat.threadId, 'send_media')) {
toast(POSTING_MEDIA_NOT_ALLOWED);
return;
}
@@ -1569,7 +1577,7 @@ export default class ChatInput {
}
};
- private onHelperCancel = (e?: Event) => {
+ private onHelperCancel = (e?: Event, force?: boolean) => {
if(e) {
cancelEvent(e);
}
@@ -1593,6 +1601,24 @@ export default class ChatInput {
if(needReturn) return;
}
+ if(this.helperType === 'edit' && !force) {
+ const message = this.editMessage
+ const value = RichTextProcessor.parseMarkdown(this.messageInputField.value, []);
+ if(message.message !== value) {
+ new PopupPeer('discard-editing', {
+ buttons: [{
+ langKey: 'Alert.Confirm.Discard',
+ callback: () => {
+ this.onHelperCancel(undefined, true);
+ }
+ }],
+ descriptionLangKey: 'Chat.Edit.Cancel.Text'
+ }).show();
+
+ return;
+ }
+ }
+
this.clearHelper();
this.updateSendBtn();
};
@@ -1726,7 +1752,7 @@ export default class ChatInput {
//return;
if(this.editMsgId) {
- const message = this.chat.getMessage(this.editMsgId);
+ const message = this.editMessage;
if(!!value.trim() || message.media) {
this.appMessagesManager.editMessage(message, value, {
entities,
@@ -1758,7 +1784,7 @@ export default class ChatInput {
const scheduleDate = this.scheduleDate;
setTimeout(() => {
for(const fromPeerId in forwarding) {
- this.appMessagesManager.forwardMessages(peerId, +fromPeerId, forwarding[fromPeerId], {
+ this.appMessagesManager.forwardMessages(peerId, fromPeerId.toPeerId(), forwarding[fromPeerId], {
silent,
scheduleDate: scheduleDate
});
@@ -1773,7 +1799,7 @@ export default class ChatInput {
document = this.appDocsManager.getDoc(document);
const flag = document.type === 'sticker' ? 'send_stickers' : (document.type === 'gif' ? 'send_gifs' : 'send_media');
- if(this.chat.peerId < 0 && !this.appMessagesManager.canSendToPeer(this.chat.peerId, this.chat.threadId, flag)) {
+ if(this.chat.peerId.isAnyChat() && !this.appMessagesManager.canSendToPeer(this.chat.peerId, this.chat.threadId, flag)) {
toast(POSTING_MEDIA_NOT_ALLOWED);
return false;
}
@@ -1817,7 +1843,7 @@ export default class ChatInput {
} */
public initMessageEditing(mid: number) {
- const message = this.chat.getMessage(mid);
+ const message: Message.message = this.chat.getMessage(mid);
let input = RichTextProcessor.wrapDraftText(message.message, {entities: message.totalEntities});
const f = () => {
@@ -1825,26 +1851,27 @@ export default class ChatInput {
this.setTopInfo('edit', f, i18n('AccDescrEditing'), replyFragment, input, message);
this.editMsgId = mid;
+ this.editMessage = message;
input = undefined;
};
f();
}
- public initMessagesForward(fromPeerIdsMids: {[fromPeerId: number]: number[]}) {
+ public initMessagesForward(fromPeerIdsMids: {[fromPeerId: PeerId]: number[]}) {
const f = () => {
//const peerTitles: string[]
- const fromPeerIds = Object.keys(fromPeerIdsMids).map(str => +str);
- const smth: Set = new Set();
+ const fromPeerIds = Object.keys(fromPeerIdsMids).map(fromPeerId => fromPeerId.toPeerId());
+ const smth: Set = new Set();
let length = 0;
fromPeerIds.forEach(fromPeerId => {
const mids = fromPeerIdsMids[fromPeerId];
mids.forEach(mid => {
- const message = this.appMessagesManager.getMessageByPeer(fromPeerId, mid);
+ const message: Message.message = this.appMessagesManager.getMessageByPeer(fromPeerId, mid);
if(message.fwd_from?.from_name && !message.fromId && !message.fwdFromId) {
- smth.add(message.fwd_from.from_name);
+ smth.add('N' + message.fwd_from.from_name);
} else {
- smth.add(message.fromId);
+ smth.add('P' + message.fromId);
}
});
@@ -1853,8 +1880,10 @@ export default class ChatInput {
const onlyFirstName = smth.size > 2;
const peerTitles = [...smth].map(smth => {
- return typeof(smth) === 'number' ?
- new PeerTitle({peerId: smth, dialog: false, onlyFirstName}).element :
+ const type = smth[0];
+ smth = smth.slice(1);
+ return type === 'P' ?
+ new PeerTitle({peerId: smth.toPeerId(), dialog: false, onlyFirstName}).element :
(onlyFirstName ? smth.split(' ')[0] : smth);
});
@@ -1895,6 +1924,10 @@ export default class ChatInput {
}
public initMessageReply(mid: number) {
+ if(this.replyToMsgId === mid) {
+ return;
+ }
+
let message: Message = this.chat.getMessage(mid);
const f = () => {
let peerTitleEl: HTMLElement;
@@ -1937,9 +1970,12 @@ export default class ChatInput {
this.willSendWebPage = null;
}
- this.replyToMsgId = undefined;
- this.forwarding = undefined;
- this.editMsgId = undefined;
+ if(type !== 'reply') {
+ this.replyToMsgId = undefined;
+ this.forwarding = undefined;
+ }
+
+ this.editMsgId = this.editMessage = undefined;
this.helperType = this.helperFunc = undefined;
if(this.chat.container.classList.contains('is-helper-active')) {
@@ -1961,12 +1997,18 @@ export default class ChatInput {
});
}
- public setTopInfo(type: ChatInputHelperType,
+ public setTopInfo(
+ type: ChatInputHelperType,
callerFunc: () => void,
title: Parameters[0] = '',
subtitle: Parameters[1] = '',
input?: string,
- message?: any) {
+ message?: any
+ ) {
+ if(this.willSendWebPage && type === 'reply') {
+ return;
+ }
+
if(type !== 'webpage') {
this.clearHelper(type);
this.helperType = type;
@@ -1978,6 +2020,7 @@ export default class ChatInput {
replyParent.lastElementChild.remove();
}
+ this.replyElements.iconBtn.replaceWith(this.replyElements.iconBtn = ButtonIcon((type === 'webpage' ? 'link' : type) + ' active reply-icon', {noRipple: true}));
replyParent.append(wrapReply(title, subtitle, message));
this.chat.container.classList.add('is-helper-active');
diff --git a/src/components/chat/mentionsHelper.ts b/src/components/chat/mentionsHelper.ts
index 55d7d9a2..ade7f625 100644
--- a/src/components/chat/mentionsHelper.ts
+++ b/src/components/chat/mentionsHelper.ts
@@ -21,7 +21,7 @@ export default class MentionsHelper extends AutocompletePeerHelper {
controller,
'mentions-helper',
(target) => {
- const user = appUsersManager.getUser(+(target as HTMLElement).dataset.peerId);
+ const user = appUsersManager.getUser((target as HTMLElement).dataset.peerId);
let str = '', entity: MessageEntity;
if(user.username) {
str = '@' + user.username;
@@ -41,12 +41,12 @@ export default class MentionsHelper extends AutocompletePeerHelper {
);
}
- public checkQuery(query: string, peerId: number, topMsgId: number) {
+ public checkQuery(query: string, peerId: PeerId, topMsgId: number) {
const trimmed = query.trim(); // check that there is no whitespace
if(query.length !== trimmed.length) return false;
const middleware = this.controller.getMiddleware();
- this.appProfileManager.getMentions(peerId ? -peerId : 0, trimmed, topMsgId).then(peerIds => {
+ this.appProfileManager.getMentions(peerId && peerId.toChatId(), trimmed, topMsgId).then(peerIds => {
if(!middleware()) return;
const username = trimmed.slice(1).toLowerCase();
diff --git a/src/components/chat/messageRender.ts b/src/components/chat/messageRender.ts
index dde236e5..170a60ea 100644
--- a/src/components/chat/messageRender.ts
+++ b/src/components/chat/messageRender.ts
@@ -31,14 +31,7 @@ export namespace MessageRender {
if(!message.fwd_from?.saved_from_msg_id && chat.type !== 'pinned') {
const forward = document.createElement('div');
- forward.classList.add('bubble-beside-button', 'forward');
- forward.innerHTML = `
- `;
+ forward.classList.add('bubble-beside-button', 'forward', 'tgico-forward_filled');
bubbleContainer.append(forward);
bubble.classList.add('with-beside-button');
}
diff --git a/src/components/chat/replies.ts b/src/components/chat/replies.ts
index 02d4790c..e94bf900 100644
--- a/src/components/chat/replies.ts
+++ b/src/components/chat/replies.ts
@@ -14,6 +14,7 @@ import { ripple } from "../ripple";
import AvatarElement from "../avatar";
import { i18n } from "../../lib/langPack";
import replaceContent from "../../helpers/dom/replaceContent";
+import appChatsManager from "../../lib/appManagers/appChatsManager";
const TAG_NAME = 'replies-element';
@@ -117,7 +118,7 @@ export default class RepliesElement extends HTMLElement {
}
if(replies) {
- const historyStorage = appMessagesManager.getHistoryStorage(-replies.channel_id);
+ const historyStorage = appMessagesManager.getHistoryStorage(replies.channel_id.toPeerId(true));
let isUnread = false;
if(replies.replies) {
if(replies.read_max_id !== undefined && replies.max_id !== undefined) {
diff --git a/src/components/chat/replyContainer.ts b/src/components/chat/replyContainer.ts
index 1fe835d7..9d3d3843 100644
--- a/src/components/chat/replyContainer.ts
+++ b/src/components/chat/replyContainer.ts
@@ -52,7 +52,7 @@ export function wrapReplyDivAndCaption(options: {
media = media.webpage;
}
- if(media.photo || (media.document && ['video', 'sticker', 'gif', 'round', 'photo'].indexOf(media.document.type) !== -1)) {
+ if(media.photo || (media.document && media.document.thumbs?.length)/* ['video', 'sticker', 'gif', 'round', 'photo', 'audio'].indexOf(media.document.type) !== -1) */) {
middleware = appImManager.chat.bubbles.getMiddleware();
const lazyLoadQueue = appImManager.chat.bubbles.lazyLoadQueue;
diff --git a/src/components/chat/replyKeyboard.ts b/src/components/chat/replyKeyboard.ts
index 2609ebb3..a8ef1b36 100644
--- a/src/components/chat/replyKeyboard.ts
+++ b/src/components/chat/replyKeyboard.ts
@@ -24,7 +24,7 @@ export default class ReplyKeyboard extends DropdownHover {
private listenerSetter: ListenerSetter;
private appMessagesManager: AppMessagesManager;
private btnHover: HTMLElement;
- private peerId: number;
+ private peerId: PeerId;
private touchListener: Listener;
private chatInput: ChatInput;
@@ -139,7 +139,7 @@ export default class ReplyKeyboard extends DropdownHover {
return !hide;
}
- public setPeer(peerId: number) {
+ public setPeer(peerId: PeerId) {
this.peerId = peerId;
this.checkAvailability();
diff --git a/src/components/chat/search.ts b/src/components/chat/search.ts
index d3e51730..566002e1 100644
--- a/src/components/chat/search.ts
+++ b/src/components/chat/search.ts
@@ -140,7 +140,7 @@ export default class ChatSearch {
selectResult = (elem: HTMLElement) => {
if(this.setPeerPromise) return this.setPeerPromise;
- const peerId = +elem.dataset.peerId;
+ const peerId = elem.dataset.peerId.toPeerId();
const lastMsgId = +elem.dataset.mid || undefined;
const index = whichChild(elem);
diff --git a/src/components/chat/selection.ts b/src/components/chat/selection.ts
index f09bde64..113fd2f6 100644
--- a/src/components/chat/selection.ts
+++ b/src/components/chat/selection.ts
@@ -37,14 +37,14 @@ import { attachContextMenuListener } from "../misc";
import { attachClickEvent, AttachClickOptions } from "../../helpers/dom/clickEvent";
import findUpAsChild from "../../helpers/dom/findUpAsChild";
-const accumulateMapSet = (map: Map>) => {
+const accumulateMapSet = (map: Map>) => {
return [...map.values()].reduce((acc, v) => acc + v.size, 0);
};
//const MIN_CLICK_MOVE = 32; // minimum bubble height
class AppSelection {
- public selectedMids: Map> = new Map();
+ public selectedMids: Map> = new Map();
public isSelecting = false;
public selectedText: string;
@@ -57,7 +57,7 @@ class AppSelection {
protected onToggleSelection: (forwards: boolean) => void;
protected onUpdateContainer: (cantForward: boolean, cantDelete: boolean, cantSend: boolean) => void;
protected onCancelSelection: () => void;
- protected toggleByMid: (peerId: number, mid: number) => void;
+ protected toggleByMid: (peerId: PeerId, mid: number) => void;
protected toggleByElement: (bubble: HTMLElement) => void;
protected navigationType: NavigationItem['type'];
@@ -157,7 +157,7 @@ class AppSelection {
return;
}
- const seen: Map> = new Map();
+ const seen: AppSelection['selectedMids'] = new Map();
let selecting: boolean;
/* let good = false;
@@ -175,7 +175,7 @@ class AppSelection {
const processElement = (element: HTMLElement, checkBetween = true) => {
const mid = +element.dataset.mid;
- const peerId = +element.dataset.peerId;
+ const peerId = (element.dataset.peerId || '').toPeerId();
if(!mid || !peerId) return;
if(!isInDOM(firstTarget)) {
@@ -280,7 +280,7 @@ class AppSelection {
}
protected isElementShouldBeSelected(element: HTMLElement) {
- return this.isMidSelected(+element.dataset.peerId, +element.dataset.mid);
+ return this.isMidSelected(element.dataset.peerId.toPeerId(), +element.dataset.mid);
}
protected appendCheckbox(element: HTMLElement, checkboxField: CheckboxField) {
@@ -435,7 +435,7 @@ class AppSelection {
SetTransition(element, 'is-selected', isSelected, 200);
}
- public isMidSelected(peerId: number, mid: number) {
+ public isMidSelected(peerId: PeerId, mid: number) {
const set = this.selectedMids.get(peerId);
return set?.has(mid);
}
@@ -444,7 +444,7 @@ class AppSelection {
return accumulateMapSet(this.selectedMids);
}
- protected toggleMid(peerId: number, mid: number, unselect?: boolean) {
+ protected toggleMid(peerId: PeerId, mid: number, unselect?: boolean) {
let set = this.selectedMids.get(peerId);
if(unselect || (unselect === undefined && set?.has(mid))) {
if(set) {
@@ -488,7 +488,7 @@ class AppSelection {
/**
* ! Call this method only to handle deleted messages
*/
- public deleteSelectedMids(peerId: number, mids: number[]) {
+ public deleteSelectedMids(peerId: PeerId, mids: number[]) {
const set = this.selectedMids.get(peerId);
if(!set) {
return;
@@ -556,7 +556,7 @@ export class SearchSelection extends AppSelection {
public toggleByElement = (element: HTMLElement) => {
const mid = +element.dataset.mid;
- const peerId = +element.dataset.peerId;
+ const peerId = element.dataset.peerId.toPeerId();
if(!this.toggleMid(peerId, mid)) {
return;
@@ -565,7 +565,7 @@ export class SearchSelection extends AppSelection {
this.updateElementSelection(element, this.isMidSelected(peerId, mid));
};
- public toggleByMid = (peerId: number, mid: number) => {
+ public toggleByMid = (peerId: PeerId, mid: number) => {
const element = this.searchSuper.mediaTab.contentTab.querySelector(`.search-super-item[data-peer-id="${peerId}"][data-mid="${mid}"]`) as HTMLElement;
this.toggleByElement(element);
};
@@ -620,7 +620,7 @@ export class SearchSelection extends AppSelection {
this.selectionForwardBtn = ButtonIcon(`forward ${BASE_CLASS}-forward`);
attachClickEvent(this.selectionForwardBtn, () => {
- const obj: {[fromPeerId: number]: number[]} = {};
+ const obj: {[frompeerId: PeerId]: number[]} = {};
for(const [fromPeerId, mids] of this.selectedMids) {
obj[fromPeerId] = Array.from(mids);
}
@@ -773,7 +773,7 @@ export default class ChatSelection extends AppSelection {
this.updateElementSelection(bubble, this.isMidSelected(this.bubbles.peerId, mid));
};
- protected toggleByMid = (peerId: number, mid: number) => {
+ protected toggleByMid = (peerId: PeerId, mid: number) => {
const mounted = this.bubbles.getMountedBubble(mid);
if(mounted) {
this.toggleByElement(mounted.bubble);
@@ -895,7 +895,7 @@ export default class ChatSelection extends AppSelection {
this.selectionForwardBtn = Button('btn-primary btn-transparent text-bold selection-container-forward', {icon: 'forward'});
this.selectionForwardBtn.append(i18n('Forward'));
attachClickEvent(this.selectionForwardBtn, () => {
- const obj: {[fromPeerId: number]: number[]} = {};
+ const obj: {[frompeerId: PeerId]: number[]} = {};
for(const [fromPeerId, mids] of this.selectedMids) {
obj[fromPeerId] = Array.from(mids);
}
diff --git a/src/components/chat/sendContextMenu.ts b/src/components/chat/sendContextMenu.ts
index a9f0aa29..7d0b33f1 100644
--- a/src/components/chat/sendContextMenu.ts
+++ b/src/components/chat/sendContextMenu.ts
@@ -57,7 +57,7 @@ export default class SendMenu {
}, options.listenerSetter);
}
- public setPeerId(peerId: number) {
+ public setPeerId(peerId: PeerId) {
this.type = peerId === rootScope.myId ? 'reminder' : 'schedule';
}
};
diff --git a/src/components/chat/topbar.ts b/src/components/chat/topbar.ts
index 0f67e451..4dd1191c 100644
--- a/src/components/chat/topbar.ts
+++ b/src/components/chat/topbar.ts
@@ -44,6 +44,7 @@ import generateVerifiedIcon from "../generateVerifiedIcon";
import { fastRaf } from "../../helpers/schedulers";
import AppEditContactTab from "../sidebarRight/tabs/editContact";
import appMediaPlaybackController from "../appMediaPlaybackController";
+import { NULL_PEER_ID } from "../../lib/mtproto/mtproto_config";
export default class ChatTopbar {
public container: HTMLDivElement;
@@ -63,8 +64,8 @@ export default class ChatTopbar {
public pinnedMessage: ChatPinnedMessage;
private setUtilsRAF: number;
- public peerId: number;
- private wasPeerId: number;
+ public peerId: PeerId;
+ private wasPeerId: PeerId;
private setPeerStatusInterval: number;
public listenerSetter: ListenerSetter;
@@ -156,7 +157,8 @@ export default class ChatTopbar {
this.container.append(this.btnBack, this.chatInfo, this.chatUtils);
if(this.chatAudio) {
- this.container.append(this.chatAudio.divAndCaption.container, this.chatUtils);
+ // this.container.append(this.chatAudio.divAndCaption.container, this.chatUtils);
+ this.container.append(this.chatAudio.divAndCaption.container);
}
// * construction end
@@ -177,12 +179,12 @@ export default class ChatTopbar {
}
const mid = +container.dataset.mid;
- const peerId = +container.dataset.peerId;
if(container.classList.contains('pinned-message')) {
//if(!this.pinnedMessage.locked) {
this.pinnedMessage.followPinnedMessage(mid);
//}
} else {
+ const peerId = container.dataset.peerId.toPeerId();
const searchContext = appMediaPlaybackController.getSearchContext();
this.chat.appImManager.setInnerPeer(
peerId,
@@ -214,14 +216,14 @@ export default class ChatTopbar {
} else {
const isFirstChat = this.chat.appImManager.chats.indexOf(this.chat) === 0;
appNavigationController.back(isFirstChat ? 'im' : 'chat');
- return;
+ /* return;
if(mediaSizes.activeScreen === ScreenSize.medium && !appNavigationController.findItemByType('chat')) {
this.chat.appImManager.setPeer(0);
blurActiveElement();
} else {
appNavigationController.back('chat');
- }
+ } */
}
};
@@ -259,14 +261,14 @@ export default class ChatTopbar {
icon: 'comments',
text: 'ViewDiscussion',
onClick: () => {
- this.appProfileManager.getChannelFull(-this.peerId).then(channelFull => {
+ this.appProfileManager.getChannelFull(this.peerId.toChatId()).then(channelFull => {
if(channelFull.linked_chat_id) {
- this.chat.appImManager.setInnerPeer(-channelFull.linked_chat_id);
+ this.chat.appImManager.setInnerPeer(channelFull.linked_chat_id.toPeerId(true));
}
});
},
verify: () => {
- const chatFull = this.appProfileManager.chatsFull[-this.peerId];
+ const chatFull = this.appProfileManager.chatsFull[this.peerId.toChatId()];
return this.chat.type === 'chat' && this.appPeersManager.isBroadcast(this.peerId) && !!(chatFull as ChatFull.channelFull)?.linked_chat_id;
}
}, {
@@ -310,7 +312,7 @@ export default class ChatTopbar {
this.appSidebarRight.toggleSidebar(true);
}
},
- verify: () => this.peerId > 0 && !this.appUsersManager.isContact(this.peerId)
+ verify: () => this.appPeersManager.isContact(this.peerId)
}, {
icon: 'forward',
text: 'ShareContact',
@@ -349,7 +351,7 @@ export default class ChatTopbar {
selfPresence: 'ChatYourSelf'
});
},
- verify: () => rootScope.myId !== this.peerId && this.peerId > 0 && this.appUsersManager.isContact(this.peerId)
+ verify: () => rootScope.myId !== this.peerId && this.appPeersManager.isContact(this.peerId)
}, {
icon: 'lock',
text: 'BlockUser',
@@ -373,8 +375,9 @@ export default class ChatTopbar {
}).show();
},
verify: () => {
- const userFull = this.appProfileManager.usersFull[this.peerId];
- return this.peerId > 0 && this.peerId !== rootScope.myId && userFull && !userFull.pFlags?.blocked;
+ const userId = this.peerId.toUserId();
+ const userFull = this.appProfileManager.usersFull[userId];
+ return this.appPeersManager.isUser(this.peerId) && this.peerId !== rootScope.myId && userFull && !userFull.pFlags?.blocked;
}
}, {
icon: 'lockoff',
@@ -387,8 +390,8 @@ export default class ChatTopbar {
});
},
verify: () => {
- const userFull = this.appProfileManager.usersFull[this.peerId];
- return this.peerId > 0 && !!userFull?.pFlags?.blocked;
+ const userFull = this.appProfileManager.usersFull[this.peerId.toUserId()];
+ return this.appPeersManager.isUser(this.peerId) && !!userFull?.pFlags?.blocked;
}
}, {
icon: 'delete danger',
@@ -440,7 +443,7 @@ export default class ChatTopbar {
const middleware = this.chat.bubbles.getMiddleware();
this.btnJoin.setAttribute('disabled', 'true');
- const chatId = -this.peerId;
+ const chatId = this.peerId.toChatId();
let promise: Promise;
if(this.appChatsManager.isChannel(chatId)) {
promise = this.appChatsManager.joinChannel(chatId);
@@ -458,7 +461,7 @@ export default class ChatTopbar {
}, {listenerSetter: this.listenerSetter});
this.listenerSetter.add(rootScope)('chat_update', (chatId) => {
- if(this.peerId === -chatId) {
+ if(this.peerId === chatId.toPeerId(true)) {
const chat = this.appChatsManager.getChat(chatId) as Channel/* | Chat */;
this.btnJoin.classList.toggle('hide', !(chat as Channel)?.pFlags?.left);
@@ -554,7 +557,7 @@ export default class ChatTopbar {
delete this.pinnedMessage;
}
- public setPeer(peerId: number) {
+ public setPeer(peerId: PeerId) {
this.wasPeerId = this.peerId;
this.peerId = peerId;
@@ -570,12 +573,15 @@ export default class ChatTopbar {
}
const isBroadcast = this.appPeersManager.isBroadcast(peerId);
-
this.btnMute && this.btnMute.classList.toggle('hide', !isBroadcast);
- if(this.btnJoin) {
- replaceContent(this.btnJoin, i18n(this.appChatsManager.isChannel(-peerId) ? 'Chat.Subscribe' : 'ChannelJoin'));
- this.btnJoin.classList.toggle('hide', !this.appChatsManager.getChat(-peerId)?.pFlags?.left);
+ if(this.appPeersManager.isAnyChat(peerId)) {
+ if(this.btnJoin) {
+ const chatId = peerId.toChatId();
+ replaceContent(this.btnJoin, i18n(this.appChatsManager.isChannel(chatId) ? 'Chat.Subscribe' : 'ChannelJoin'));
+ this.btnJoin.classList.toggle('hide', !this.appChatsManager.getChat(chatId)?.pFlags?.left);
+ }
}
+
this.setUtilsWidth();
const middleware = this.chat.bubbles.getMiddleware();
@@ -626,7 +632,7 @@ export default class ChatTopbar {
// ! костыль х2, это нужно делать в другом месте
if(!count) {
- this.chat.appImManager.setPeer(0); // * close tab
+ this.chat.appImManager.setPeer(NULL_PEER_ID); // * close tab
// ! костыль, это скроет закреплённые сообщения сразу, вместо того, чтобы ждать пока анимация перехода закончится
const originalChat = this.chat.appImManager.chat;
diff --git a/src/components/dialogsContextMenu.ts b/src/components/dialogsContextMenu.ts
index d224c3a1..c12a3f48 100644
--- a/src/components/dialogsContextMenu.ts
+++ b/src/components/dialogsContextMenu.ts
@@ -23,7 +23,7 @@ export default class DialogsContextMenu {
private element: HTMLElement;
private buttons: (ButtonMenuItemOptions & {verify: () => boolean})[];
- private selectedId: number;
+ private selectedId: PeerId;
private filterId: number;
private dialog: Dialog;
@@ -32,24 +32,18 @@ export default class DialogsContextMenu {
icon: 'unread',
text: 'MarkAsUnread',
onClick: this.onUnreadClick,
- verify: () => {
- const isUnread = !!(this.dialog.pFlags?.unread_mark || this.dialog.unread_count);
- return !isUnread;
- }
+ verify: () => !appMessagesManager.isDialogUnread(this.dialog)
}, {
icon: 'readchats',
text: 'MarkAsRead',
onClick: this.onUnreadClick,
- verify: () => {
- const isUnread = !!(this.dialog.pFlags?.unread_mark || this.dialog.unread_count);
- return isUnread;
- }
+ verify: () => appMessagesManager.isDialogUnread(this.dialog)
}, {
icon: 'pin',
text: 'ChatList.Context.Pin',
onClick: this.onPinClick,
verify: () => {
- const isPinned = this.filterId > 1 ? appMessagesManager.filtersStorage.getFilter(this.filterId).pinned_peers.includes(this.dialog.peerId) : !!this.dialog.pFlags?.pinned;
+ const isPinned = this.filterId > 1 ? appMessagesManager.filtersStorage.getFilter(this.filterId).pinnedPeerIds.includes(this.dialog.peerId) : !!this.dialog.pFlags?.pinned;
return !isPinned;
}
}, {
@@ -57,7 +51,7 @@ export default class DialogsContextMenu {
text: 'ChatList.Context.Unpin',
onClick: this.onPinClick,
verify: () => {
- const isPinned = this.filterId > 1 ? appMessagesManager.filtersStorage.getFilter(this.filterId).pinned_peers.includes(this.dialog.peerId) : !!this.dialog.pFlags?.pinned;
+ const isPinned = this.filterId > 1 ? appMessagesManager.filtersStorage.getFilter(this.filterId).pinnedPeerIds.includes(this.dialog.peerId) : !!this.dialog.pFlags?.pinned;
return isPinned;
}
}, {
@@ -174,7 +168,7 @@ export default class DialogsContextMenu {
this.filterId = appDialogsManager.filterId;
- this.selectedId = +li.dataset.peerId;
+ this.selectedId = li.dataset.peerId.toPeerId();
this.dialog = appMessagesManager.getDialogOnly(this.selectedId);
this.buttons.forEach(button => {
diff --git a/src/components/editPeer.ts b/src/components/editPeer.ts
index 8b2a1068..ba8ddb8c 100644
--- a/src/components/editPeer.ts
+++ b/src/components/editPeer.ts
@@ -22,13 +22,13 @@ export default class EditPeer {
private inputFields: InputField[];
private listenerSetter: ListenerSetter;
- private peerId: number;
+ private peerId: PeerId;
private _disabled = false;
private avatarSize = 120;
constructor(options: {
- peerId?: number,
+ peerId?: EditPeer['peerId'],
inputFields: EditPeer['inputFields'],
listenerSetter: ListenerSetter,
doNotEditAvatar?: boolean,
diff --git a/src/components/emoticonsDropdown/tabs/gifs.ts b/src/components/emoticonsDropdown/tabs/gifs.ts
index 12d0458d..b44dedbf 100644
--- a/src/components/emoticonsDropdown/tabs/gifs.ts
+++ b/src/components/emoticonsDropdown/tabs/gifs.ts
@@ -23,7 +23,7 @@ export default class GifsTab implements EmoticonsTab {
const masonry = new GifsMasonry(gifsContainer, EMOTICONSSTICKERGROUP, scroll);
const preloader = putPreloader(this.content, true);
- apiManager.invokeApi('messages.getSavedGifs', {hash: 0}).then((res) => {
+ apiManager.invokeApi('messages.getSavedGifs', {hash: '0'}).then((res) => {
//console.log('getSavedGifs res:', res);
if(res._ === 'messages.savedGifs') {
diff --git a/src/components/emoticonsDropdown/tabs/stickers.ts b/src/components/emoticonsDropdown/tabs/stickers.ts
index 12b5caa4..293e3058 100644
--- a/src/components/emoticonsDropdown/tabs/stickers.ts
+++ b/src/components/emoticonsDropdown/tabs/stickers.ts
@@ -198,8 +198,8 @@ export default class StickersTab implements EmoticonsTab {
async renderStickerSet(set: StickerSet.stickerSet, prepend = false) {
const categoryDiv = document.createElement('div');
categoryDiv.classList.add('sticker-category');
- categoryDiv.dataset.id = set.id;
- categoryDiv.dataset.access_hash = set.access_hash;
+ categoryDiv.dataset.id = '' + set.id;
+ categoryDiv.dataset.access_hash = '' + set.access_hash;
const button = document.createElement('button');
button.classList.add('btn-icon', 'menu-horizontal-div-item');
diff --git a/src/components/gifsMasonry.ts b/src/components/gifsMasonry.ts
index 8a080eb5..9ffb4792 100644
--- a/src/components/gifsMasonry.ts
+++ b/src/components/gifsMasonry.ts
@@ -198,7 +198,7 @@ export default class GifsMasonry {
div.style.width = size.width + 'px';
div.style.opacity = '0';
//div.style.height = h + 'px';
- div.dataset.docId = doc.id;
+ div.dataset.docId = '' + doc.id;
appendTo.append(div);
diff --git a/src/components/lazyLoadQueue.ts b/src/components/lazyLoadQueue.ts
index 41dddb8d..263042bf 100644
--- a/src/components/lazyLoadQueue.ts
+++ b/src/components/lazyLoadQueue.ts
@@ -6,7 +6,7 @@
import { logger, LogTypes } from "../lib/logger";
import VisibilityIntersector, { OnVisibilityChange } from "./visibilityIntersector";
-import { findAndSpliceAll } from "../helpers/array";
+import { findAndSpliceAll, indexOfAndSplice } from "../helpers/array";
import throttle from "../helpers/schedulers/throttle";
type LazyLoadElementBase = {
@@ -121,7 +121,7 @@ export class LazyLoadQueueBase {
let added = 0;
do {
if(item) {
- this.queue.findAndSplice(i => i === item);
+ indexOfAndSplice(this.queue, item);
} else {
item = this.getItem();
}
diff --git a/src/components/peerProfile.ts b/src/components/peerProfile.ts
index f95b3a80..2557d40b 100644
--- a/src/components/peerProfile.ts
+++ b/src/components/peerProfile.ts
@@ -52,7 +52,7 @@ export default class PeerProfile {
private setBioTimeout: number;
private setPeerStatusInterval: number;
- private peerId = 0;
+ private peerId: PeerId;
private threadId: number;
constructor(public scrollable: Scrollable) {
@@ -264,7 +264,7 @@ export default class PeerProfile {
}
//let membersLi = this.profileTabs.firstElementChild.children[0] as HTMLLIElement;
- if(peerId > 0) {
+ if(peerId.isUser()) {
//membersLi.style.display = 'none';
let user = appUsersManager.getUser(peerId);
@@ -304,7 +304,7 @@ export default class PeerProfile {
}
let promise: Promise;
- if(peerId > 0) {
+ if(peerId.isUser()) {
promise = appProfileManager.getProfile(peerId, override).then(userFull => {
if(this.peerId !== peerId || this.threadId !== threadId) {
//this.log.warn('peer changed');
@@ -319,7 +319,7 @@ export default class PeerProfile {
return true;
});
} else {
- promise = appProfileManager.getChatFull(-peerId, override).then((chatFull) => {
+ promise = appProfileManager.getChatFull(peerId.toChatId(), override).then((chatFull) => {
if(this.peerId !== peerId || this.threadId !== threadId) {
//this.log.warn('peer changed');
return false;
@@ -342,8 +342,8 @@ export default class PeerProfile {
});
}
- public setPeer(peerId: number, threadId = 0) {
- if(this.peerId === peerId && this.threadId === peerId) return;
+ public setPeer(peerId: PeerId, threadId = 0) {
+ if(this.peerId === peerId && this.threadId === threadId) return;
if(this.init) {
this.init();
diff --git a/src/components/peerProfileAvatars.ts b/src/components/peerProfileAvatars.ts
index 300c449e..003b6d86 100644
--- a/src/components/peerProfileAvatars.ts
+++ b/src/components/peerProfileAvatars.ts
@@ -28,8 +28,8 @@ export default class PeerProfileAvatars {
public arrowPrevious: HTMLElement;
public arrowNext: HTMLElement;
private tabs: HTMLDivElement;
- private listLoader: ListLoader;
- private peerId: number;
+ private listLoader: ListLoader;
+ private peerId: PeerId;
constructor(public scrollable: Scrollable) {
this.container = document.createElement('div');
@@ -48,14 +48,14 @@ export default class PeerProfileAvatars {
this.tabs.classList.add(PeerProfileAvatars.BASE_CLASS + '-tabs');
this.arrowPrevious = document.createElement('div');
- this.arrowPrevious.classList.add(PeerProfileAvatars.BASE_CLASS + '-arrow');
+ this.arrowPrevious.classList.add(PeerProfileAvatars.BASE_CLASS + '-arrow', 'tgico-avatarprevious');
/* const previousIcon = document.createElement('i');
previousIcon.classList.add(PeerProfileAvatars.BASE_CLASS + '-arrow-icon', 'tgico-previous');
this.arrowBack.append(previousIcon); */
this.arrowNext = document.createElement('div');
- this.arrowNext.classList.add(PeerProfileAvatars.BASE_CLASS + '-arrow', PeerProfileAvatars.BASE_CLASS + '-arrow-next');
+ this.arrowNext.classList.add(PeerProfileAvatars.BASE_CLASS + '-arrow', PeerProfileAvatars.BASE_CLASS + '-arrow-next', 'tgico-avatarnext');
/* const nextIcon = document.createElement('i');
nextIcon.classList.add(PeerProfileAvatars.BASE_CLASS + '-arrow-icon', 'tgico-next');
@@ -101,7 +101,7 @@ export default class PeerProfileAvatars {
|| (clickX > (rect.width * SWITCH_ZONE) && clickX < (rect.width - rect.width * SWITCH_ZONE))) {
const peerId = this.peerId;
- const targets: {element: HTMLElement, item: string | Message.messageService}[] = [];
+ const targets: {element: HTMLElement, item: Photo.photo['id'] | Message.messageService}[] = [];
this.listLoader.previous.concat(this.listLoader.current, this.listLoader.next).forEach((item, idx) => {
targets.push({
element: /* null */this.avatars.children[idx] as HTMLElement,
@@ -199,7 +199,7 @@ export default class PeerProfileAvatars {
});
}
- public setPeer(peerId: number) {
+ public setPeer(peerId: PeerId) {
this.peerId = peerId;
const photo = appPeersManager.getPeerPhoto(peerId);
@@ -212,8 +212,8 @@ export default class PeerProfileAvatars {
loadMore: (anchor, older, loadCount) => {
if(!older) return Promise.resolve({count: undefined, items: []});
- if(peerId > 0) {
- const maxId: string = (anchor || listLoader.current) as any;
+ if(peerId.isUser()) {
+ const maxId: Photo.photo['id'] = (anchor || listLoader.current) as any;
return appPhotosManager.getUserPhotos(peerId, maxId, loadCount).then(value => {
return {
count: value.count,
@@ -223,7 +223,7 @@ export default class PeerProfileAvatars {
} else {
const promises: [Promise, ReturnType] = [] as any;
if(!listLoader.current) {
- promises.push(appProfileManager.getChatFull(-peerId));
+ promises.push(appProfileManager.getChatFull(peerId.toChatId()));
}
promises.push(appMessagesManager.getSearch({
@@ -295,13 +295,13 @@ export default class PeerProfileAvatars {
this.container.classList.toggle('is-single', this.tabs.childElementCount <= 1);
}
- public processItem = (photoId: string | Message.messageService) => {
+ public processItem = (photoId: Photo.photo['id'] | Message.messageService) => {
const avatar = document.createElement('div');
avatar.classList.add(PeerProfileAvatars.BASE_CLASS + '-avatar');
let photo: Photo.photo;
if(photoId) {
- photo = typeof(photoId) === 'string' ?
+ photo = typeof(photoId) !== 'object' ?
appPhotosManager.getPhoto(photoId) :
(photoId.action as MessageAction.messageActionChannelEditPhoto).photo as Photo.photo;
}
diff --git a/src/components/peerTitle.ts b/src/components/peerTitle.ts
index 34d6e590..357e997c 100644
--- a/src/components/peerTitle.ts
+++ b/src/components/peerTitle.ts
@@ -12,7 +12,7 @@ import replaceContent from "../helpers/dom/replaceContent";
import appUsersManager from "../lib/appManagers/appUsersManager";
export type PeerTitleOptions = {
- peerId: number,
+ peerId: PeerId,
plainText?: boolean,
onlyFirstName?: boolean,
dialog?: boolean
@@ -36,7 +36,7 @@ rootScope.addEventListener('peer_title_edit', (peerId) => {
export default class PeerTitle {
public element: HTMLElement;
- public peerId: number;
+ public peerId: PeerId;
public plainText = false;
public onlyFirstName = false;
public dialog = false;
@@ -61,7 +61,7 @@ export default class PeerTitle {
}
if(this.peerId !== rootScope.myId || !this.dialog) {
- if(this.peerId > 0 && appUsersManager.getUser(this.peerId).pFlags.deleted) {
+ if(this.peerId.isUser() && appUsersManager.getUser(this.peerId).pFlags.deleted) {
replaceContent(this.element, i18n(this.onlyFirstName ? 'Deleted' : 'HiddenName'));
} else {
this.element.innerHTML = appPeersManager.getPeerTitle(this.peerId, this.plainText, this.onlyFirstName);
diff --git a/src/components/poll.ts b/src/components/poll.ts
index 0fabc713..58afc792 100644
--- a/src/components/poll.ts
+++ b/src/components/poll.ts
@@ -7,7 +7,7 @@
import mediaSizes from "../helpers/mediaSizes";
import { IS_TOUCH_SUPPORTED } from "../environment/touchSupport";
import appImManager from "../lib/appManagers/appImManager";
-import appPollsManager, { Poll, PollResults } from "../lib/appManagers/appPollsManager";
+import appPollsManager from "../lib/appManagers/appPollsManager";
import serverTimeManager from "../lib/mtproto/serverTimeManager";
import { RichTextProcessor } from "../lib/richtextprocessor";
import rootScope from "../lib/rootScope";
@@ -22,6 +22,7 @@ import { cancelEvent } from "../helpers/dom/cancelEvent";
import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent";
import replaceContent from "../helpers/dom/replaceContent";
import windowSize from "../helpers/windowSize";
+import { Poll, PollResults } from "../layer";
let lineTotalLength = 0;
const tailLength = 9;
@@ -92,9 +93,7 @@ rootScope.on('poll_update', (e) => {
}
}); */
-rootScope.addEventListener('poll_update', (e) => {
- const {poll, results} = e as {poll: Poll, results: PollResults};
-
+rootScope.addEventListener('poll_update', ({poll, results}) => {
const pollElements = Array.from(document.querySelectorAll(`poll-element[poll-id="${poll.id}"]`)) as PollElement[];
pollElements.forEach(pollElement => {
//console.log('poll_update', poll, results);
diff --git a/src/components/popups/createPoll.ts b/src/components/popups/createPoll.ts
index 1709ca5d..85a8df52 100644
--- a/src/components/popups/createPoll.ts
+++ b/src/components/popups/createPoll.ts
@@ -4,7 +4,6 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
-import type { Poll } from "../../lib/appManagers/appPollsManager";
import type Chat from "../chat/chat";
import PopupElement from ".";
import CheckboxField from "../checkboxField";
@@ -19,6 +18,7 @@ import getRichValue from "../../helpers/dom/getRichValue";
import isInputEmpty from "../../helpers/dom/isInputEmpty";
import whichChild from "../../helpers/dom/whichChild";
import { attachClickEvent } from "../../helpers/dom/clickEvent";
+import { Poll } from "../../layer";
const MAX_LENGTH_QUESTION = 255;
const MAX_LENGTH_OPTION = 100;
diff --git a/src/components/popups/deleteDialog.ts b/src/components/popups/deleteDialog.ts
index 834d4cb6..1e8f09da 100644
--- a/src/components/popups/deleteDialog.ts
+++ b/src/components/popups/deleteDialog.ts
@@ -13,7 +13,7 @@ import PopupPeer, { PopupPeerButtonCallbackCheckboxes, PopupPeerOptions } from "
export default class PopupDeleteDialog {
constructor(
- peerId: number,
+ peerId: PeerId,
// actionType: 'leave' | 'delete',
peerType: PeerType = appPeersManager.getDialogType(peerId),
onSelect?: (promise: Promise) => void
@@ -26,7 +26,7 @@ export default class PopupDeleteDialog {
}; */
const callbackLeave = (checked: PopupPeerButtonCallbackCheckboxes, flush = checkboxes && !!checked.size) => {
- let promise = appChatsManager.leave(-peerId);
+ let promise = appChatsManager.leave(peerId.toChatId());
if(flush) {
promise = promise.finally(() => {
@@ -40,11 +40,11 @@ export default class PopupDeleteDialog {
const callbackDelete = (checked: PopupPeerButtonCallbackCheckboxes) => {
let promise: Promise;
- if(peerId > 0) {
+ if(peerId.isUser()) {
promise = appMessagesManager.flushHistory(peerId, false, checkboxes ? !!checked.size : undefined);
} else {
if(checked.size) {
- promise = appChatsManager.delete(-peerId);
+ promise = appChatsManager.delete(peerId.toChatId());
} else {
return callbackLeave(checked);
}
@@ -56,7 +56,7 @@ export default class PopupDeleteDialog {
let title: LangPackKey, description: LangPackKey, descriptionArgs: any[], buttons: PopupPeerOptions['buttons'], checkboxes: PopupPeerOptions['checkboxes'];
switch(peerType) {
case 'channel': {
- if(/* actionType === 'delete' && */appChatsManager.hasRights(-peerId, 'delete_chat')) {
+ if(/* actionType === 'delete' && */appChatsManager.hasRights(peerId.toChatId(), 'delete_chat')) {
appChatsManager.deleteChannel
title = 'ChannelDeleteMenu';
description = 'AreYouSureDeleteAndExitChannel';
@@ -130,7 +130,7 @@ export default class PopupDeleteDialog {
case 'megagroup':
case 'group': {
- if(/* actionType === 'delete' && */appChatsManager.hasRights(-peerId, 'delete_chat')) {
+ if(/* actionType === 'delete' && */appChatsManager.hasRights(peerId.toChatId(), 'delete_chat')) {
title = 'DeleteMegaMenu';
description = 'AreYouSureDeleteAndExit';
buttons = [{
diff --git a/src/components/popups/deleteMessages.ts b/src/components/popups/deleteMessages.ts
index f340fd82..cea63737 100644
--- a/src/components/popups/deleteMessages.ts
+++ b/src/components/popups/deleteMessages.ts
@@ -15,7 +15,7 @@ import PeerTitle from "../peerTitle";
import appPeersManager from "../../lib/appManagers/appPeersManager";
export default class PopupDeleteMessages {
- constructor(peerId: number, mids: number[], type: ChatType, onConfirm?: () => void) {
+ constructor(peerId: PeerId, mids: number[], type: ChatType, onConfirm?: () => void) {
const peerTitleElement = new PeerTitle({peerId}).element;
mids = mids.slice();
@@ -51,15 +51,15 @@ export default class PopupDeleteMessages {
if(peerId === rootScope.myId || type === 'scheduled') {
} else {
- if(peerId > 0) {
+ if(peerId.isUser()) {
checkboxes.push({
text: 'DeleteMessagesOptionAlso',
textArgs: [peerTitleElement]
});
} else {
- const chat = appChatsManager.getChat(-peerId);
+ const chat = appChatsManager.getChat(peerId.toChatId());
- const hasRights = appChatsManager.hasRights(-peerId, 'delete_messages');
+ const hasRights = appChatsManager.hasRights(peerId.toChatId(), 'delete_messages');
if(chat._ === 'chat') {
const canRevoke = hasRights ? mids.slice() : mids.filter(mid => {
const message = appMessagesManager.getMessageByPeer(peerId, mid);
diff --git a/src/components/popups/forward.ts b/src/components/popups/forward.ts
index cd2b6d3b..a20a7ca2 100644
--- a/src/components/popups/forward.ts
+++ b/src/components/popups/forward.ts
@@ -9,8 +9,8 @@ import PopupPickUser from "./pickUser";
export default class PopupForward extends PopupPickUser {
constructor(
- peerIdMids: {[fromPeerId: number]: number[]},
- onSelect?: (peerId: number) => Promise | void,
+ peerIdMids: {[frompeerId: PeerId]: number[]},
+ onSelect?: (peerId: PeerId) => Promise | void,
onClose?: () => void,
overrideOnSelect = false
) {
diff --git a/src/components/popups/joinChatInvite.ts b/src/components/popups/joinChatInvite.ts
index 7ccf8ab4..92b6f41e 100644
--- a/src/components/popups/joinChatInvite.ts
+++ b/src/components/popups/joinChatInvite.ts
@@ -8,9 +8,11 @@ import PopupElement, { addCancelButton } from ".";
import { ChatInvite, Updates } from "../../layer";
import apiUpdatesManager from "../../lib/appManagers/apiUpdatesManager";
import appAvatarsManager from "../../lib/appManagers/appAvatarsManager";
+import appChatsManager from "../../lib/appManagers/appChatsManager";
import appPhotosManager from "../../lib/appManagers/appPhotosManager";
import { i18n } from "../../lib/langPack";
import apiManager from "../../lib/mtproto/mtprotoworker";
+import { NULL_PEER_ID } from "../../lib/mtproto/mtproto_config";
import RichTextProcessor from "../../lib/richtextprocessor";
import rootScope from "../../lib/rootScope";
import AvatarElement from "../avatar";
@@ -27,7 +29,7 @@ export default class PopupJoinChatInvite extends PopupElement {
.then((updates) => {
apiUpdatesManager.processUpdateMessage(updates);
const chat = (updates as Updates.updates).chats[0];
- const peerId = -chat.id;
+ const peerId = chat.id.toPeerId(true);
rootScope.dispatchEvent('history_focus', {peerId});
});
}
@@ -63,7 +65,7 @@ export default class PopupJoinChatInvite extends PopupElement {
});
avatarElem.style.width = avatarElem.style.height = '';
} else {
- appAvatarsManager.putPhoto(avatarElem, -0, false, chatInvite.title);
+ appAvatarsManager.putPhoto(avatarElem, NULL_PEER_ID, false, chatInvite.title);
}
const title = document.createElement('div');
diff --git a/src/components/popups/peer.ts b/src/components/popups/peer.ts
index 3f065211..22169cb4 100644
--- a/src/components/popups/peer.ts
+++ b/src/components/popups/peer.ts
@@ -14,7 +14,7 @@ export type PopupPeerButtonCallback = (checkboxes?: PopupPeerButtonCallbackCheck
export type PopupPeerCheckboxOptions = CheckboxFieldOptions & {checkboxField?: CheckboxField};
export type PopupPeerOptions = PopupOptions & Partial<{
- peerId: number,
+ peerId: PeerId,
title: string,
titleLangKey?: LangPackKey,
titleLangArgs?: any[],
diff --git a/src/components/popups/pickUser.ts b/src/components/popups/pickUser.ts
index 47021eab..8a68d616 100644
--- a/src/components/popups/pickUser.ts
+++ b/src/components/popups/pickUser.ts
@@ -14,7 +14,7 @@ export default class PopupPickUser extends PopupElement {
constructor(options: {
peerTypes: AppSelectPeers['peerType'],
- onSelect?: (peerId: number) => Promise | void,
+ onSelect?: (peerId: PeerId) => Promise | void,
onClose?: () => void,
placeholder: LangPackKey,
chatRightsAction?: AppSelectPeers['chatRightsAction'],
@@ -29,7 +29,7 @@ export default class PopupPickUser extends PopupElement {
appendTo: this.body,
onChange: async() => {
const selected = this.selector.getSelected();
- const peerId = selected[selected.length - 1];
+ const peerId = selected[selected.length - 1].toPeerId();
if(options.onSelect) {
const res = options.onSelect(peerId);
diff --git a/src/components/popups/reportMessages.ts b/src/components/popups/reportMessages.ts
index 9bdaca41..4552d62b 100644
--- a/src/components/popups/reportMessages.ts
+++ b/src/components/popups/reportMessages.ts
@@ -15,7 +15,7 @@ import PopupPeer from "./peer";
import PopupReportMessagesConfirm from "./reportMessagesConfirm";
export default class PopupReportMessages extends PopupPeer {
- constructor(peerId: number, mids: number[], onConfirm?: () => void) {
+ constructor(peerId: PeerId, mids: number[], onConfirm?: () => void) {
super('popup-report-messages', {titleLangKey: 'ChatTitle.ReportMessages', buttons: [], body: true});
mids = mids.slice();
diff --git a/src/components/popups/reportMessagesConfirm.ts b/src/components/popups/reportMessagesConfirm.ts
index 25c1e515..485dbed4 100644
--- a/src/components/popups/reportMessagesConfirm.ts
+++ b/src/components/popups/reportMessagesConfirm.ts
@@ -14,7 +14,7 @@ import PopupPeer from "./peer";
export default class PopupReportMessagesConfirm extends PopupPeer {
public static STICKER_EMOJI = '👮♀️';
- constructor(peerId: number, mids: number[], reason: ReportReason['_'], onConfirm?: () => void) {
+ constructor(peerId: PeerId, mids: number[], reason: ReportReason['_'], onConfirm?: () => void) {
super('popup-report-messages-confirm', {
noTitle: true,
descriptionLangKey: 'ReportInfo',
diff --git a/src/components/popups/sendNow.ts b/src/components/popups/sendNow.ts
index 48d8e65b..2122225c 100644
--- a/src/components/popups/sendNow.ts
+++ b/src/components/popups/sendNow.ts
@@ -9,7 +9,7 @@ import { PopupButton } from ".";
import PopupPeer from "./peer";
export default class PopupSendNow {
- constructor(peerId: number, mids: number[], onConfirm?: () => void) {
+ constructor(peerId: PeerId, mids: number[], onConfirm?: () => void) {
let title: string, description: string, buttons: PopupButton[] = [];
title = `Send Message${mids.length > 1 ? 's' : ''} Now`;
diff --git a/src/components/popups/unpinMessage.ts b/src/components/popups/unpinMessage.ts
index cf49bca2..c7dd799e 100644
--- a/src/components/popups/unpinMessage.ts
+++ b/src/components/popups/unpinMessage.ts
@@ -14,7 +14,7 @@ import appChatsManager from "../../lib/appManagers/appChatsManager";
import PeerTitle from "../peerTitle";
export default class PopupPinMessage {
- constructor(peerId: number, mid: number, unpin?: true, onConfirm?: () => void) {
+ constructor(peerId: PeerId, mid: number, unpin?: true, onConfirm?: () => void) {
let title: LangPackKey, description: LangPackKey, descriptionArgs: FormatterArguments,
buttons: PopupPeerOptions['buttons'] = [], checkboxes: PopupPeerOptions['checkboxes'] = [];
@@ -65,13 +65,13 @@ export default class PopupPinMessage {
title = 'PinMessageAlertTitle';
const pinButtonText: LangPackKey = 'PinMessage';
- if(peerId < 0) {
+ if(peerId.isAnyChat()) {
buttons.push({
langKey: pinButtonText,
callback: (checked) => callback(checked, false, !checked.size)
});
- if(appChatsManager.isBroadcast(-peerId)) {
+ if(appChatsManager.isBroadcast(peerId.toChatId())) {
description = 'PinMessageAlertChannel';
} else {
description = 'PinMessageAlert';
diff --git a/src/components/privacySection.ts b/src/components/privacySection.ts
index f5f3c06b..77369f4d 100644
--- a/src/components/privacySection.ts
+++ b/src/components/privacySection.ts
@@ -6,6 +6,7 @@
import { randomLong } from "../helpers/random";
import { InputPrivacyKey, InputPrivacyRule } from "../layer";
+import appChatsManager from "../lib/appManagers/appChatsManager";
import appPrivacyManager, { PrivacyType } from "../lib/appManagers/appPrivacyManager";
import appUsersManager from "../lib/appManagers/appUsersManager";
import { i18n, join, LangPackKey, _i18n } from "../lib/langPack";
@@ -29,8 +30,8 @@ export default class PrivacySection {
clickable: true
}>;
public peerIds: {
- disallow?: number[],
- allow?: number[]
+ disallow?: PeerId[],
+ allow?: PeerId[]
};
public type: PrivacyType;
@@ -152,8 +153,8 @@ export default class PrivacySection {
(['allow', 'disallow'] as ('allow' | 'disallow')[]).forEach(k => {
const arr = [];
const from = k === 'allow' ? details.allowPeers : details.disallowPeers;
- arr.push(...from.users);
- arr.push(...from.chats.map(id => -id));
+ arr.push(...from.users.map(id => id.toPeerId()));
+ arr.push(...from.chats.map(id => id.toPeerId(false)));
this.peerIds[k] = arr;
const s = this.exceptions.get(k).row.subtitle;
s.innerHTML = '';
@@ -189,12 +190,11 @@ export default class PrivacySection {
return;
}
- const _peerIds: number[] = this.peerIds[k];
-
+ const _peerIds = this.peerIds[k];
if(_peerIds) {
const splitted = this.splitPeersByType(_peerIds);
if(splitted.chats.length) {
- rules.push({_: chatKey, chats: splitted.chats.map(peerId => -peerId)});
+ rules.push({_: chatKey, chats: splitted.chats.map(peerId => peerId.toChatId())});
}
if(splitted.users.length) {
@@ -236,16 +236,16 @@ export default class PrivacySection {
row.radioField.input.checked = true;
}
- private splitPeersByType(peerIds: number[]) {
- const peers = {users: [] as number[], chats: [] as number[]};
+ private splitPeersByType(peerIds: PeerId[]) {
+ const peers = {users: [] as UserId[], chats: [] as ChatId[]};
peerIds.forEach(peerId => {
- peers[peerId < 0 ? 'chats' : 'users'].push(peerId < 0 ? -peerId : peerId);
+ peers[peerId.isAnyChat() ? 'chats' : 'users'].push(peerId.isAnyChat() ? peerId.toChatId() : peerId);
});
return peers;
}
- private generateStr(peers: {users: number[], chats: number[]}) {
+ private generateStr(peers: {users: UserId[], chats: ChatId[]}) {
if(!peers.users.length && !peers.chats.length) {
return [i18n('PrivacySettingsController.AddUsers')];
}
diff --git a/src/components/sidebarLeft/index.ts b/src/components/sidebarLeft/index.ts
index d736fd4b..1cc8216f 100644
--- a/src/components/sidebarLeft/index.ts
+++ b/src/components/sidebarLeft/index.ts
@@ -39,6 +39,7 @@ import replaceContent from "../../helpers/dom/replaceContent";
import sessionStorage from "../../lib/sessionStorage";
import { CLICK_EVENT_NAME } from "../../helpers/dom/clickEvent";
import { closeBtnMenu } from "../misc";
+import { indexOfAndSplice } from "../../helpers/array";
export const LEFT_COLUMN_ACTIVE_CLASSNAME = 'is-left-column-shown';
@@ -71,7 +72,6 @@ export class AppSidebarLeft extends SidebarSlider {
const onNewGroupClick = () => {
new AppAddMembersTab(this).open({
- peerId: 0,
type: 'chat',
skippable: false,
takeOut: (peerIds) => {
@@ -96,8 +96,8 @@ export class AppSidebarLeft extends SidebarSlider {
new AppArchivedTab(this).open();
},
verify: () => {
- const folder = appMessagesManager.dialogsStorage.getFolder(1);
- return !!folder.length;
+ const folder = appMessagesManager.dialogsStorage.getFolderDialogs(1, false);
+ return !!folder.length || !appMessagesManager.dialogsStorage.isDialogsLoaded(1);
}
};
@@ -174,7 +174,10 @@ export class AppSidebarLeft extends SidebarSlider {
icon: 'char z',
text: 'ChatList.Menu.SwitchTo.Z',
onClick: () => {
- sessionStorage.set({kz_version: 'Z'}).then(() => {
+ Promise.all([
+ sessionStorage.set({kz_version: 'Z'}),
+ sessionStorage.delete('tgme_sync')
+ ]).then(() => {
location.href = 'https://web.telegram.org/z/';
});
},
@@ -183,7 +186,9 @@ export class AppSidebarLeft extends SidebarSlider {
icon: 'char w',
text: 'ChatList.Menu.SwitchTo.Webogram',
onClick: () => {
- location.href = 'https://web.telegram.org/?legacy=1';
+ sessionStorage.delete('tgme_sync').then(() => {
+ location.href = 'https://web.telegram.org/?legacy=1';
+ });
},
verify: () => App.isMainDomain
}];
@@ -250,9 +255,13 @@ export class AppSidebarLeft extends SidebarSlider {
btnArchive.element.append(this.archivedCount);
- rootScope.addEventListener('dialogs_archived_unread', (e) => {
- this.archivedCount.innerText = '' + formatNumber(e.count, 1);
- this.archivedCount.classList.toggle('hide', !e.count);
+ rootScope.addEventListener('folder_unread', (folder) => {
+ if(folder.id === 1) {
+ // const count = folder.unreadMessagesCount;
+ const count = folder.unreadDialogsCount;
+ this.archivedCount.innerText = '' + formatNumber(count, 1);
+ this.archivedCount.classList.toggle('hide', !count);
+ }
});
appUsersManager.getTopPeers('correspondents');
@@ -322,7 +331,7 @@ export class AppSidebarLeft extends SidebarSlider {
const resetSearch = () => {
searchSuper.setQuery({
- peerId: 0,
+ peerId: ''.toPeerId(),
folderId: 0
});
searchSuper.selectTab(0);
@@ -332,7 +341,7 @@ export class AppSidebarLeft extends SidebarSlider {
resetSearch();
let pickedElements: HTMLElement[] = [];
- let selectedPeerId = 0;
+ let selectedPeerId: PeerId = ''.toPeerId();
let selectedMinDate = 0;
let selectedMaxDate = 0;
const updatePicked = () => {
@@ -361,7 +370,7 @@ export class AppSidebarLeft extends SidebarSlider {
selectedMinDate = +minDate;
selectedMaxDate = +maxDate;
} else {
- selectedPeerId = +key;
+ selectedPeerId = key.toPeerId();
}
target.addEventListener('click', () => {
@@ -376,7 +385,7 @@ export class AppSidebarLeft extends SidebarSlider {
searchSuper.nav.parentElement.append(helper);
- const renderEntity = (peerId: any, title?: string | HTMLElement) => {
+ const renderEntity = (key: PeerId | string, title?: string | HTMLElement) => {
const div = document.createElement('div');
div.classList.add('selector-user'/* , 'scale-in' */);
@@ -385,13 +394,13 @@ export class AppSidebarLeft extends SidebarSlider {
avatarEl.setAttribute('dialog', '1');
avatarEl.classList.add('avatar-30');
- div.dataset.key = '' + peerId;
- if(typeof(peerId) === 'number') {
+ div.dataset.key = '' + key;
+ if(key.isPeerId()) {
if(title === undefined) {
- title = new PeerTitle({peerId}).element;
+ title = new PeerTitle({peerId: key.toPeerId()}).element;
}
- avatarEl.setAttribute('peer', '' + peerId);
+ avatarEl.setAttribute('peer', '' + key);
} else {
avatarEl.classList.add('tgico-calendarfilter');
}
@@ -415,11 +424,11 @@ export class AppSidebarLeft extends SidebarSlider {
if(key.indexOf('date_') === 0) {
selectedMinDate = selectedMaxDate = 0;
} else {
- selectedPeerId = 0;
+ selectedPeerId = ''.toPeerId();
}
target.remove();
- pickedElements.findAndSplice(t => t === target);
+ indexOfAndSplice(pickedElements, target);
setTimeout(() => {
updatePicked();
@@ -452,8 +461,9 @@ export class AppSidebarLeft extends SidebarSlider {
if(!selectedPeerId && value.trim()) {
const middleware = searchSuper.middleware.get();
Promise.all([
- appMessagesManager.getConversationsAll(value).then(dialogs => dialogs.map(d => d.peerId)),
- appUsersManager.getContacts(value, true)
+ // appMessagesManager.getConversationsAll(value).then(dialogs => dialogs.map(d => d.peerId)),
+ appMessagesManager.getConversations(value).promise.then(({dialogs}) => dialogs.map(d => d.peerId)),
+ appUsersManager.getContactsPeerIds(value, true)
]).then(results => {
if(!middleware()) return;
const peerIds = new Set(results[0].concat(results[1]));
@@ -489,11 +499,11 @@ export class AppSidebarLeft extends SidebarSlider {
return;
}
- const peerId = +target.getAttribute('data-peer-id');
+ const peerId = target.getAttribute('data-peer-id').toPeerId();
appStateManager.getState().then(state => {
const recentSearch = state.recentSearch || [];
if(recentSearch[0] !== peerId) {
- recentSearch.findAndSplice(p => p === peerId);
+ indexOfAndSplice(recentSearch, peerId);
recentSearch.unshift(peerId);
if(recentSearch.length > 20) {
recentSearch.length = 20;
diff --git a/src/components/sidebarLeft/tabs/activeSessions.ts b/src/components/sidebarLeft/tabs/activeSessions.ts
index 3372459d..f01b9339 100644
--- a/src/components/sidebarLeft/tabs/activeSessions.ts
+++ b/src/components/sidebarLeft/tabs/activeSessions.ts
@@ -38,7 +38,7 @@ export default class AppActiveSessionsTab extends SliderSuperTab {
titleRight: auth.pFlags.current ? undefined : formatDateAccordingToTodayNew(new Date(Math.max(auth.date_active, auth.date_created) * 1000))
});
- row.container.dataset.hash = auth.hash;
+ row.container.dataset.hash = '' + auth.hash;
const midtitle = document.createElement('div');
midtitle.classList.add('row-midtitle');
diff --git a/src/components/sidebarLeft/tabs/addMembers.ts b/src/components/sidebarLeft/tabs/addMembers.ts
index 6e020329..42219dbc 100644
--- a/src/components/sidebarLeft/tabs/addMembers.ts
+++ b/src/components/sidebarLeft/tabs/addMembers.ts
@@ -14,7 +14,7 @@ export default class AppAddMembersTab extends SliderSuperTab {
private nextBtn: HTMLButtonElement;
private selector: AppSelectPeers;
private peerType: 'channel' | 'chat' | 'privacy';
- private takeOut: (peerIds: number[]) => Promise | false | void;
+ private takeOut: (peerIds: PeerId[]) => Promise | false | void;
private skippable: boolean;
protected init() {
@@ -23,7 +23,7 @@ export default class AppAddMembersTab extends SliderSuperTab {
this.scrollable.container.remove();
this.nextBtn.addEventListener('click', () => {
- const peerIds = this.selector.getSelected();
+ const peerIds = this.selector.getSelected().map(sel => sel.toPeerId());
if(this.skippable) {
this.takeOut(peerIds);
@@ -53,11 +53,10 @@ export default class AppAddMembersTab extends SliderSuperTab {
public open(options: {
title: LangPackKey,
placeholder: LangPackKey,
- peerId?: number,
type: AppAddMembersTab['peerType'],
takeOut?: AppAddMembersTab['takeOut'],
skippable: boolean,
- selectedPeerIds?: number[]
+ selectedPeerIds?: PeerId[]
}) {
const ret = super.open();
diff --git a/src/components/sidebarLeft/tabs/background.ts b/src/components/sidebarLeft/tabs/background.ts
index f983e78c..974c39ba 100644
--- a/src/components/sidebarLeft/tabs/background.ts
+++ b/src/components/sidebarLeft/tabs/background.ts
@@ -35,7 +35,7 @@ export default class AppBackgroundTab extends SliderSuperTab {
private grid: HTMLElement;
private tempId = 0;
private theme: Theme;
- private clicked: Set = new Set();
+ private clicked: Set = new Set();
private blurCheckboxField: CheckboxField;
init() {
@@ -162,7 +162,7 @@ export default class AppBackgroundTab extends SliderSuperTab {
wallpaper = _wallpaper as WallPaper.wallPaper;
wallpaper.document = appDocsManager.saveDoc(wallpaper.document);
- container.dataset.docId = wallpaper.document.id;
+ container.dataset.docId = '' + wallpaper.document.id;
container.dataset.slug = wallpaper.slug;
this.setBackgroundDocument(wallpaper.slug, wallpaper.document).then(deferred.resolve, deferred.reject);
@@ -223,7 +223,7 @@ export default class AppBackgroundTab extends SliderSuperTab {
size: appPhotosManager.choosePhotoSize(wallpaper.document, 200, 200)
});
- container.dataset.docId = wallpaper.document.id;
+ container.dataset.docId = '' + wallpaper.document.id;
container.dataset.slug = wallpaper.slug;
if(this.theme.background.type === 'image' && this.theme.background.slug === wallpaper.slug) {
diff --git a/src/components/sidebarLeft/tabs/blockedUsers.ts b/src/components/sidebarLeft/tabs/blockedUsers.ts
index 6b816874..1ee00405 100644
--- a/src/components/sidebarLeft/tabs/blockedUsers.ts
+++ b/src/components/sidebarLeft/tabs/blockedUsers.ts
@@ -17,7 +17,7 @@ import ButtonCorner from "../../buttonCorner";
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
export default class AppBlockedUsersTab extends SliderSuperTab {
- public peerIds: number[];
+ public peerIds: PeerId[];
private menuElement: HTMLElement;
protected init() {
@@ -50,7 +50,7 @@ export default class AppBlockedUsersTab extends SliderSuperTab {
this.scrollable.container.classList.add('chatlist-container');
this.scrollable.append(list);
- const add = (peerId: number, append: boolean) => {
+ const add = (peerId: PeerId, append: boolean) => {
const {dom} = appDialogsManager.addDialogNew({
dialog: peerId,
container: list,
@@ -78,7 +78,7 @@ export default class AppBlockedUsersTab extends SliderSuperTab {
let target: HTMLElement;
const onUnblock = () => {
- const peerId = +target.dataset.peerId;
+ const peerId = target.dataset.peerId.toPeerId();
appUsersManager.toggleBlock(peerId, false);
};
diff --git a/src/components/sidebarLeft/tabs/chatFolders.ts b/src/components/sidebarLeft/tabs/chatFolders.ts
index b8095d69..74efbb3c 100644
--- a/src/components/sidebarLeft/tabs/chatFolders.ts
+++ b/src/components/sidebarLeft/tabs/chatFolders.ts
@@ -11,7 +11,6 @@ import { toast } from "../../toast";
import type { MyDialogFilter } from "../../../lib/storages/filters";
import type { DialogFilterSuggested, DialogFilter } from "../../../layer";
import type _rootScope from "../../../lib/rootScope";
-import type { BroadcastEvents } from "../../../lib/rootScope";
import Button from "../../button";
import appMessagesManager from "../../../lib/appManagers/appMessagesManager";
import appPeersManager from "../../../lib/appManagers/appPeersManager";
@@ -65,7 +64,7 @@ export default class AppChatFoldersTab extends SliderSuperTab {
}
if(!d.length) {
- const folder = appMessagesManager.dialogsStorage.getFolder(filter.id);
+ const folder = appMessagesManager.dialogsStorage.getFolderDialogs(filter.id);
let chats = 0, channels = 0, groups = 0;
for(const dialog of folder) {
if(appPeersManager.isAnyGroup(dialog.peerId)) groups++;
@@ -170,8 +169,7 @@ export default class AppChatFoldersTab extends SliderSuperTab {
onFiltersContainerUpdate();
});
- this.listenerSetter.add(rootScope)('filter_update', (e) => {
- const filter = e;
+ this.listenerSetter.add(rootScope)('filter_update', (filter) => {
if(this.filtersRendered.hasOwnProperty(filter.id)) {
this.renderFolder(filter, null, this.filtersRendered[filter.id]);
} else {
@@ -183,8 +181,7 @@ export default class AppChatFoldersTab extends SliderSuperTab {
this.getSuggestedFilters();
});
- this.listenerSetter.add(rootScope)('filter_delete', (e) => {
- const filter = e;
+ this.listenerSetter.add(rootScope)('filter_delete', (filter) => {
if(this.filtersRendered.hasOwnProperty(filter.id)) {
/* for(const suggested of this.suggestedFilters) {
if(deepEqual(suggested.filter, filter)) {
@@ -200,8 +197,7 @@ export default class AppChatFoldersTab extends SliderSuperTab {
onFiltersContainerUpdate();
});
- this.listenerSetter.add(rootScope)('filter_order', (e: BroadcastEvents['filter_order']) => {
- const order = e;
+ this.listenerSetter.add(rootScope)('filter_order', (order) => {
order.forEach((filterId, idx) => {
const container = this.filtersRendered[filterId].container;
positionElementByIndex(container, container.parentElement, idx + 1); // ! + 1 due to header
diff --git a/src/components/sidebarLeft/tabs/contacts.ts b/src/components/sidebarLeft/tabs/contacts.ts
index 2edba4c2..091da443 100644
--- a/src/components/sidebarLeft/tabs/contacts.ts
+++ b/src/components/sidebarLeft/tabs/contacts.ts
@@ -44,8 +44,9 @@ export default class AppContactsTab extends SliderSuperTab {
this.listenerSetter.add(rootScope)('contacts_update', (userId) => {
const isContact = appUsersManager.isContact(userId);
- if(isContact) this.sortedUserList.add(userId);
- else this.sortedUserList.delete(userId);
+ const peerId = userId.toPeerId();
+ if(isContact) this.sortedUserList.add(peerId);
+ else this.sortedUserList.delete(peerId);
});
this.title.replaceWith(this.inputSearch.container);
@@ -90,7 +91,7 @@ export default class AppContactsTab extends SliderSuperTab {
this.scrollable.onScrolledBottom = null;
this.scrollable.container.textContent = '';
- appUsersManager.getContacts(query, undefined, 'online').then(contacts => {
+ appUsersManager.getContactsPeerIds(query, undefined, 'online').then(contacts => {
if(!middleware()) {
return;
}
diff --git a/src/components/sidebarLeft/tabs/editFolder.ts b/src/components/sidebarLeft/tabs/editFolder.ts
index e398809d..5be328fe 100644
--- a/src/components/sidebarLeft/tabs/editFolder.ts
+++ b/src/components/sidebarLeft/tabs/editFolder.ts
@@ -31,8 +31,8 @@ export default class AppEditFolderTab extends SliderSuperTab {
private menuBtn: HTMLElement;
private nameInputField: InputField;
- private include_peers: SettingSection;
- private exclude_peers: SettingSection;
+ private includePeerIds: SettingSection;
+ private excludePeerIds: SettingSection;
private flags: {[k in 'contacts' | 'non_contacts' | 'groups' | 'broadcasts' | 'bots' | 'exclude_muted' | 'exclude_archived' | 'exclude_read']: HTMLElement} = {} as any;
private animation: RLottiePlayer;
@@ -108,7 +108,7 @@ export default class AppEditFolderTab extends SliderSuperTab {
return section;
};
- this.include_peers = generateList('folder-list-included', 'FilterInclude', [{
+ this.includePeerIds = generateList('folder-list-included', 'FilterInclude', [{
icon: 'add primary',
text: 'ChatList.Filter.Include.AddChat',
withRipple: true
@@ -134,7 +134,7 @@ export default class AppEditFolderTab extends SliderSuperTab {
name: 'bots'
}], this.flags);
- this.exclude_peers = generateList('folder-list-excluded', 'FilterExclude', [{
+ this.excludePeerIds = generateList('folder-list-excluded', 'FilterExclude', [{
icon: 'minus primary',
text: 'ChatList.Filter.Exclude.AddChat',
withRipple: true
@@ -152,10 +152,10 @@ export default class AppEditFolderTab extends SliderSuperTab {
name: 'exclude_read'
}], this.flags);
- this.scrollable.append(this.stickerContainer, this.caption, inputWrapper, this.include_peers.container, this.exclude_peers.container);
+ this.scrollable.append(this.stickerContainer, this.caption, inputWrapper, this.includePeerIds.container, this.excludePeerIds.container);
- const includedFlagsContainer = this.include_peers.container.querySelector('.folder-categories');
- const excludedFlagsContainer = this.exclude_peers.container.querySelector('.folder-categories');
+ const includedFlagsContainer = this.includePeerIds.container.querySelector('.folder-categories');
+ const excludedFlagsContainer = this.excludePeerIds.container.querySelector('.folder-categories');
includedFlagsContainer.querySelector('.btn').addEventListener('click', () => {
new AppIncludedChatsTab(this.slider).open(this.filter, 'included', this);
@@ -261,7 +261,7 @@ export default class AppEditFolderTab extends SliderSuperTab {
this.flags[flag as keyof AppEditFolderTab['flags']].style.display = !!filter.pFlags[flag as keyof AppEditFolderTab['flags']] ? '' : 'none';
}
- (['include_peers', 'exclude_peers'] as ['include_peers', 'exclude_peers']).forEach(key => {
+ (['includePeerIds' as const, 'excludePeerIds' as const]).forEach(key => {
const section = this[key];
const ul = appDialogsManager.createChatList();
@@ -339,7 +339,10 @@ export default class AppEditFolderTab extends SliderSuperTab {
pFlags: {},
pinned_peers: [],
include_peers: [],
- exclude_peers: []
+ exclude_peers: [],
+ pinnedPeerIds: [],
+ includePeerIds: [],
+ excludePeerIds: []
}, true);
this.type = 'create';
this.onCreateOpen();
diff --git a/src/components/sidebarLeft/tabs/editProfile.ts b/src/components/sidebarLeft/tabs/editProfile.ts
index 29f283f7..7fecf293 100644
--- a/src/components/sidebarLeft/tabs/editProfile.ts
+++ b/src/components/sidebarLeft/tabs/editProfile.ts
@@ -12,6 +12,7 @@ import EditPeer from "../../editPeer";
import { UsernameInputField } from "../../usernameInputField";
import { i18n, i18n_ } from "../../../lib/langPack";
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
+import rootScope from "../../../lib/rootScope";
// TODO: аватарка не поменяется в этой вкладке после изменения почему-то (если поставить в другом клиенте, и потом тут проверить, для этого ещё вышел в чатлист)
@@ -65,7 +66,7 @@ export default class AppEditProfileTab extends SliderSuperTab {
this.scrollable.append(document.createElement('hr'));
this.editPeer = new EditPeer({
- peerId: appUsersManager.getSelf().id,
+ peerId: rootScope.myId,
inputFields,
listenerSetter: this.listenerSetter
});
@@ -81,7 +82,6 @@ export default class AppEditProfileTab extends SliderSuperTab {
inputWrapper.classList.add('input-wrapper');
this.usernameInputField = new UsernameInputField({
- peerId: 0,
label: 'EditProfile.Username.Label',
name: 'username',
plainText: true,
diff --git a/src/components/sidebarLeft/tabs/includedChats.ts b/src/components/sidebarLeft/tabs/includedChats.ts
index 5652ed46..8835ed12 100644
--- a/src/components/sidebarLeft/tabs/includedChats.ts
+++ b/src/components/sidebarLeft/tabs/includedChats.ts
@@ -19,6 +19,8 @@ import appMessagesManager from "../../../lib/appManagers/appMessagesManager";
import RichTextProcessor from "../../../lib/richtextprocessor";
import { SettingSection } from "..";
import { toast } from "../../toast";
+import { forEachReverse } from "../../../helpers/array";
+import appPeersManager from "../../../lib/appManagers/appPeersManager";
export default class AppIncludedChatsTab extends SliderSuperTab {
private editFolderTab: AppEditFolderTab;
@@ -29,7 +31,7 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
private filter: DialogFilter;
private originalFilter: DialogFilter;
- private dialogsByFilters: Map>;
+ private dialogsByFilters: Map>;
protected init() {
this.content.remove();
@@ -64,39 +66,41 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
}
}
- const peers: number[] = [];
+ const peerIds: PeerId[] = [];
for(const key of selected) {
- if(typeof(key) === 'number') {
- peers.push(key);
+ if(key.isPeerId()) {
+ peerIds.push(key.toPeerId());
} else {
// @ts-ignore
this.filter.pFlags[key] = true;
}
}
+ let cmp: (peerId: PeerId) => boolean;
if(this.type === 'included') {
- this.filter.pinned_peers = this.filter.pinned_peers.filter(peerId => {
- return peers.includes(peerId); // * because I have pinned peer in include_peers too
- /* const index = peers.indexOf(peerId);
- if(index !== -1) {
- peers.splice(index, 1);
- return true;
- } else {
- return false;
- } */
- });
+ cmp = (peerId) => peerIds.includes(peerId);
} else {
- this.filter.pinned_peers = this.filter.pinned_peers.filter(peerId => {
- return !peers.includes(peerId);
- });
+ cmp = (peerId) => !peerIds.includes(peerId);
}
- const other = this.type === 'included' ? 'exclude_peers' : 'include_peers';
- this.filter[other] = this.filter[other].filter(peerId => {
- return !peers.includes(peerId);
+ forEachReverse(this.filter.pinnedPeerIds, (peerId, idx) => {
+ if(!cmp(peerId)) {
+ this.filter.pinnedPeerIds.splice(idx, 1);
+ this.filter.pinned_peers.splice(idx, 1);
+ }
+ });
+
+ const other = this.type === 'included' ? 'excludePeerIds' : 'includePeerIds';
+ const otherLegacy = this.type === 'included' ? 'exclude_peers' : 'include_peers';
+ forEachReverse(this.filter[other], (peerId, idx) => {
+ if(peerIds.includes(peerId)) {
+ this.filter[other].splice(idx, 1);
+ this.filter[otherLegacy].splice(idx, 1);
+ }
});
- this.filter[this.type === 'included' ? 'include_peers' : 'exclude_peers'] = peers;
+ this.filter[this.type === 'included' ? 'includePeerIds' : 'excludePeerIds'] = peerIds;
+ this.filter[this.type === 'included' ? 'include_peers' : 'exclude_peers'] = peerIds.map(peerId => appPeersManager.getInputPeerById(peerId));
//this.filter.pinned_peers = this.filter.pinned_peers.filter(peerId => this.filter.include_peers.includes(peerId));
this.editFolderTab.setFilter(this.filter, false);
@@ -106,7 +110,7 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
this.dialogsByFilters = new Map();
return appMessagesManager.filtersStorage.getDialogFilters().then(filters => {
for(const filter of filters) {
- this.dialogsByFilters.set(filter, new Set(appMessagesManager.dialogsStorage.getFolder(filter.id).map(d => d.peerId)));
+ this.dialogsByFilters.set(filter, new Set(appMessagesManager.dialogsStorage.getFolderDialogs(filter.id).map(d => d.peerId)));
}
});
}
@@ -122,7 +126,7 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
return checkboxField.label;
}
- renderResults = async(peerIds: number[]) => {
+ renderResults = async(peerIds: PeerId[]) => {
//const other = this.type === 'included' ? this.filter.exclude_peers : this.filter.include_peers;
await appUsersManager.getContacts();
@@ -211,7 +215,7 @@ export default class AppIncludedChatsTab extends SliderSuperTab {
/////////////////
- const selectedPeers = (this.type === 'included' ? filter.include_peers : filter.exclude_peers).slice();
+ const selectedPeers = (this.type === 'included' ? filter.includePeerIds : filter.excludePeerIds).slice();
this.selector = new AppSelectPeers({
appendTo: this.container,
diff --git a/src/components/sidebarLeft/tabs/newChannel.ts b/src/components/sidebarLeft/tabs/newChannel.ts
index 2d8a5c58..1274a6f5 100644
--- a/src/components/sidebarLeft/tabs/newChannel.ts
+++ b/src/components/sidebarLeft/tabs/newChannel.ts
@@ -75,13 +75,12 @@ export default class AppNewChannelTab extends SliderSuperTab {
appSidebarLeft.removeTabFromHistory(this);
new AppAddMembersTab(this.slider).open({
- peerId: channelId,
type: 'channel',
skippable: true,
title: 'GroupAddMembers',
placeholder: 'SendMessageTo',
takeOut: (peerIds) => {
- return appChatsManager.inviteToChannel(Math.abs(channelId), peerIds);
+ return appChatsManager.inviteToChannel(channelId, peerIds);
}
});
});
diff --git a/src/components/sidebarLeft/tabs/newGroup.ts b/src/components/sidebarLeft/tabs/newGroup.ts
index 77ff3458..3ade5d00 100644
--- a/src/components/sidebarLeft/tabs/newGroup.ts
+++ b/src/components/sidebarLeft/tabs/newGroup.ts
@@ -20,7 +20,7 @@ export default class AppNewGroupTab extends SliderSuperTab {
private searchGroup = new SearchGroup(true, 'contacts', true, 'new-group-members disable-hover', false);
private avatarEdit: AvatarEdit;
private uploadAvatar: () => Promise = null;
- private userIds: number[];
+ private peerIds: PeerId[];
private nextBtn: HTMLButtonElement;
private groupNameInputField: InputField;
@@ -53,7 +53,7 @@ export default class AppNewGroupTab extends SliderSuperTab {
const title = this.groupNameInputField.value;
this.nextBtn.disabled = true;
- appChatsManager.createChat(title, this.userIds).then((chatId) => {
+ appChatsManager.createChat(title, this.peerIds).then((chatId) => {
if(this.uploadAvatar) {
this.uploadAvatar().then((inputFile) => {
appChatsManager.editPhoto(chatId, inputFile);
@@ -81,12 +81,12 @@ export default class AppNewGroupTab extends SliderSuperTab {
this.nextBtn.disabled = false;
}
- public open(userIds: number[]) {
+ public open(userIds: PeerId[]) {
const result = super.open();
result.then(() => {
- this.userIds = userIds;
+ this.peerIds = userIds;
- this.userIds.forEach(userId => {
+ this.peerIds.forEach(userId => {
let {dom} = appDialogsManager.addDialogNew({
dialog: userId,
container: this.searchGroup.list,
@@ -99,7 +99,7 @@ export default class AppNewGroupTab extends SliderSuperTab {
});
this.searchGroup.nameEl.textContent = '';
- this.searchGroup.nameEl.append(i18n('Members', [this.userIds.length]));
+ this.searchGroup.nameEl.append(i18n('Members', [this.peerIds.length]));
this.searchGroup.setActive();
});
diff --git a/src/components/sidebarLeft/tabs/privacyAndSecurity.ts b/src/components/sidebarLeft/tabs/privacyAndSecurity.ts
index c6242a83..c86b5e4f 100644
--- a/src/components/sidebarLeft/tabs/privacyAndSecurity.ts
+++ b/src/components/sidebarLeft/tabs/privacyAndSecurity.ts
@@ -46,7 +46,7 @@ export default class AppPrivacyAndSecurityTab extends SliderSuperTabEventable {
{
const section = new SettingSection({noDelimiter: true});
- let blockedPeerIds: number[];
+ let blockedPeerIds: PeerId[];
const blockedUsersRow = new Row({
icon: 'deleteuser',
titleLangKey: 'BlockedUsers',
diff --git a/src/components/sidebarLeft/tabs/settings.ts b/src/components/sidebarLeft/tabs/settings.ts
index d8d216ad..05a705c2 100644
--- a/src/components/sidebarLeft/tabs/settings.ts
+++ b/src/components/sidebarLeft/tabs/settings.ts
@@ -18,6 +18,7 @@ import AppNotificationsTab from "./notifications";
import PeerTitle from "../../peerTitle";
import AppLanguageTab from "./language";
import lottieLoader from "../../../lib/lottieLoader";
+import PopupPeer from "../../popups/peer";
//import AppMediaViewer from "../../appMediaViewerNew";
export default class AppSettingsTab extends SliderSuperTab {
@@ -42,7 +43,17 @@ export default class AppSettingsTab extends SliderSuperTab {
icon: 'logout',
text: 'EditAccount.Logout',
onClick: () => {
- apiManager.logOut();
+ new PopupPeer('logout', {
+ titleLangKey: 'LogOut',
+ descriptionLangKey: 'LogOut.Description',
+ buttons: [{
+ langKey: 'LogOut',
+ callback: () => {
+ apiManager.logOut();
+ },
+ isDanger: true
+ }]
+ }).show();
}
}]);
@@ -149,10 +160,11 @@ export default class AppSettingsTab extends SliderSuperTab {
}
public fillElements() {
- let user = appUsersManager.getSelf();
- this.avatarElem.setAttribute('peer', '' + user.id);
+ const user = appUsersManager.getSelf();
+ const peerId = user.id.toPeerId(false);
+ this.avatarElem.setAttribute('peer', '' + peerId);
- this.nameDiv.append(new PeerTitle({peerId: user.id}).element);
+ this.nameDiv.append(new PeerTitle({peerId: peerId}).element);
this.phoneDiv.innerHTML = user.phone ? appUsersManager.formatUserPhone(user.phone) : '';
}
}
diff --git a/src/components/sidebarRight/tabs/chatType.ts b/src/components/sidebarRight/tabs/chatType.ts
index 8c4a9ed0..4c4e6844 100644
--- a/src/components/sidebarRight/tabs/chatType.ts
+++ b/src/components/sidebarRight/tabs/chatType.ts
@@ -24,7 +24,7 @@ import { attachClickEvent } from "../../../helpers/dom/clickEvent";
import toggleDisability from "../../../helpers/dom/toggleDisability";
export default class AppChatTypeTab extends SliderSuperTabEventable {
- public chatId: number;
+ public chatId: ChatId;
public chatFull: ChatFull;
protected init() {
@@ -130,7 +130,7 @@ export default class AppChatTypeTab extends SliderSuperTabEventable {
invalidText: 'Link.Invalid',
takenText: 'Link.Taken',
onChange: onChange,
- peerId: -this.chatId,
+ peerId: this.chatId.toPeerId(true),
head: placeholder
});
diff --git a/src/components/sidebarRight/tabs/editChat.ts b/src/components/sidebarRight/tabs/editChat.ts
index 6f656da7..c381b395 100644
--- a/src/components/sidebarRight/tabs/editChat.ts
+++ b/src/components/sidebarRight/tabs/editChat.ts
@@ -18,7 +18,6 @@ import rootScope from "../../../lib/rootScope";
import AppGroupPermissionsTab from "./groupPermissions";
import { i18n, LangPackKey } from "../../../lib/langPack";
import PopupDeleteDialog from "../../popups/deleteDialog";
-import PopupPeer from "../../popups/peer";
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
import toggleDisability from "../../../helpers/dom/toggleDisability";
import CheckboxField from "../../checkboxField";
@@ -27,7 +26,7 @@ export default class AppEditChatTab extends SliderSuperTab {
private chatNameInputField: InputField;
private descriptionInputField: InputField;
private editPeer: EditPeer;
- public chatId: number;
+ public chatId: ChatId;
protected async _init() {
// * cleanup prev
@@ -54,6 +53,8 @@ export default class AppEditChatTab extends SliderSuperTab {
}
});
+ const peerId = this.chatId.toPeerId(true);
+
{
const section = new SettingSection({noDelimiter: true});
const inputFields: InputField[] = [];
@@ -81,7 +82,7 @@ export default class AppEditChatTab extends SliderSuperTab {
inputFields.push(this.chatNameInputField, this.descriptionInputField);
this.editPeer = new EditPeer({
- peerId: -this.chatId,
+ peerId,
inputFields,
listenerSetter: this.listenerSetter
});
@@ -283,7 +284,7 @@ export default class AppEditChatTab extends SliderSuperTab {
const btnDelete = Button('btn-primary btn-transparent danger', {icon: 'delete', text: isBroadcast ? 'PeerInfo.DeleteChannel' : 'DeleteAndExitButton'});
attachClickEvent(btnDelete, () => {
- new PopupDeleteDialog(-this.chatId/* , 'delete' */, undefined, (promise) => {
+ new PopupDeleteDialog(peerId/* , 'delete' */, undefined, (promise) => {
const toggle = toggleDisability([btnDelete], true);
promise.then(() => {
this.close();
@@ -301,8 +302,8 @@ export default class AppEditChatTab extends SliderSuperTab {
if(!isChannel) {
// ! this one will fire earlier than tab's closeAfterTimeout (destroy) event and listeners will be erased, so destroy won't fire
this.listenerSetter.add(rootScope)('dialog_migrate', ({migrateFrom, migrateTo}) => {
- if(-this.chatId === migrateFrom) {
- this.chatId = -migrateTo;
+ if(peerId === migrateFrom) {
+ this.chatId = migrateTo.toChatId();
this._init();
}
});
diff --git a/src/components/sidebarRight/tabs/editContact.ts b/src/components/sidebarRight/tabs/editContact.ts
index 46b4598c..c1b0c1a5 100644
--- a/src/components/sidebarRight/tabs/editContact.ts
+++ b/src/components/sidebarRight/tabs/editContact.ts
@@ -27,7 +27,7 @@ export default class AppEditContactTab extends SliderSuperTab {
private nameInputField: InputField;
private lastNameInputField: InputField;
private editPeer: EditPeer;
- public peerId: number;
+ public peerId: PeerId;
protected init() {
this.container.classList.add('edit-peer-container', 'edit-contact-container');
diff --git a/src/components/sidebarRight/tabs/forward.ts b/src/components/sidebarRight/tabs/forward.ts
index 72bc4f63..cb6d2d27 100644
--- a/src/components/sidebarRight/tabs/forward.ts
+++ b/src/components/sidebarRight/tabs/forward.ts
@@ -6,6 +6,7 @@
import appSidebarRight from "..";
import appMessagesManager from "../../../lib/appManagers/appMessagesManager";
+import { NULL_PEER_ID } from "../../../lib/mtproto/mtproto_config";
import AppSelectPeers from "../../appSelectPeers";
import { putPreloader } from "../../misc";
import { SliderTab } from "../../slider";
@@ -41,7 +42,7 @@ export default class AppForwardTab implements SliderTab {
this.sendBtn = this.container.querySelector('.btn-circle') as HTMLButtonElement;
this.sendBtn.addEventListener('click', () => {
- let peerIds = this.selector.getSelected();
+ let peerIds = this.selector.getSelected().map(s => s.toPeerId());
if(this.mids.length && peerIds.length) {
this.sendBtn.classList.remove('tgico-send');
@@ -51,7 +52,7 @@ export default class AppForwardTab implements SliderTab {
let s = () => {
let promises = peerIds.splice(0, 3).map(peerId => {
- return appMessagesManager.forwardMessages(peerId, 0, this.mids);
+ return appMessagesManager.forwardMessages(peerId, NULL_PEER_ID, this.mids);
});
Promise.all(promises).then(() => {
diff --git a/src/components/sidebarRight/tabs/gifs.ts b/src/components/sidebarRight/tabs/gifs.ts
index a9323e90..77e9ac57 100644
--- a/src/components/sidebarRight/tabs/gifs.ts
+++ b/src/components/sidebarRight/tabs/gifs.ts
@@ -16,6 +16,7 @@ import type { MyDocument } from "../../../lib/appManagers/appDocsManager";
import mediaSizes from "../../../helpers/mediaSizes";
import findUpClassName from "../../../helpers/dom/findUpClassName";
import { attachClickEvent } from "../../../helpers/dom/clickEvent";
+import { NULL_PEER_ID } from "../../../lib/mtproto/mtproto_config";
const ANIMATIONGROUP = 'GIFS-SEARCH';
@@ -26,7 +27,7 @@ export default class AppGifsTab extends SliderSuperTab {
private nextOffset = '';
private loadedAll = false;
- private gifBotPeerId: number;
+ private gifBotPeerId: PeerId;
private masonry: GifsMasonry;
private searchPromise: ReturnType;
@@ -100,11 +101,11 @@ export default class AppGifsTab extends SliderSuperTab {
if(this.searchPromise || this.loadedAll) return;
if(!this.gifBotPeerId) {
- this.gifBotPeerId = (await appUsersManager.resolveUsername('gif')).id;
+ this.gifBotPeerId = (await appUsersManager.resolveUsername('gif')).id.toPeerId(false);
}
try {
- this.searchPromise = appInlineBotsManager.getInlineResults(0, this.gifBotPeerId, query, this.nextOffset);
+ this.searchPromise = appInlineBotsManager.getInlineResults(NULL_PEER_ID, this.gifBotPeerId, query, this.nextOffset);
const { results, next_offset } = await this.searchPromise;
if(this.inputSearch.value !== query) {
diff --git a/src/components/sidebarRight/tabs/groupPermissions.ts b/src/components/sidebarRight/tabs/groupPermissions.ts
index f9eaeea5..2f70977e 100644
--- a/src/components/sidebarRight/tabs/groupPermissions.ts
+++ b/src/components/sidebarRight/tabs/groupPermissions.ts
@@ -34,7 +34,7 @@ export class ChatPermissions {
private toggleWith: Partial<{[chatRight in ChatRights]: ChatRights[]}>;
constructor(options: {
- chatId: number,
+ chatId: ChatId,
listenerSetter: ListenerSetter,
appendTo: HTMLElement,
participant?: ChannelParticipant.channelParticipantBanned
@@ -123,7 +123,7 @@ export class ChatPermissions {
}
export default class AppGroupPermissionsTab extends SliderSuperTabEventable {
- public chatId: number;
+ public chatId: ChatId;
protected async init() {
this.container.classList.add('edit-peer-container', 'group-permissions-container');
@@ -171,7 +171,7 @@ export default class AppGroupPermissionsTab extends SliderSuperTabEventable {
}
});
- const openPermissions = async(peerId: number) => {
+ const openPermissions = async(peerId: PeerId) => {
let participant: AppUserPermissionsTab['participant'];
try {
participant = await appProfileManager.getChannelParticipant(this.chatId, peerId) as any;
@@ -208,7 +208,7 @@ export default class AppGroupPermissionsTab extends SliderSuperTabEventable {
const target = findUpTag(e.target, 'LI');
if(!target) return;
- const peerId = +target.dataset.peerId;
+ const peerId = target.dataset.peerId.toPeerId();
openPermissions(peerId);
}, {listenerSetter: this.listenerSetter});
diff --git a/src/components/sidebarRight/tabs/pollResults.ts b/src/components/sidebarRight/tabs/pollResults.ts
index 32acd511..1209b4e3 100644
--- a/src/components/sidebarRight/tabs/pollResults.ts
+++ b/src/components/sidebarRight/tabs/pollResults.ts
@@ -77,7 +77,7 @@ export default class AppPollResultsTab extends SliderSuperTab {
appPollsManager.getVotes(message, answer.option, offset, limit).then(votesList => {
votesList.votes.forEach(vote => {
const {dom} = appDialogsManager.addDialogNew({
- dialog: vote.user_id,
+ dialog: vote.user_id.toPeerId(false),
container: list,
drawStatus: false,
rippleEnabled: false,
diff --git a/src/components/sidebarRight/tabs/search.ts b/src/components/sidebarRight/tabs/search.ts
index 1a4093a6..1d02666c 100644
--- a/src/components/sidebarRight/tabs/search.ts
+++ b/src/components/sidebarRight/tabs/search.ts
@@ -17,7 +17,7 @@ export default class AppPrivateSearchTab extends SliderSuperTab {
private appSearch: AppSearch;
private btnPickDate: HTMLElement;
- private peerId = 0;
+ private peerId: PeerId;
private threadId = 0;
private query = '';
private onDatePick: (timestamp: number) => void;
@@ -43,7 +43,7 @@ export default class AppPrivateSearchTab extends SliderSuperTab {
});
}
- open(peerId: number, threadId?: number, onDatePick?: AppPrivateSearchTab['onDatePick'], query?: string) {
+ open(peerId: PeerId, threadId?: number, onDatePick?: AppPrivateSearchTab['onDatePick'], query?: string) {
const ret = super.open();
if(!this.peerId) {
diff --git a/src/components/sidebarRight/tabs/sharedMedia.ts b/src/components/sidebarRight/tabs/sharedMedia.ts
index e3195837..4c5e9cea 100644
--- a/src/components/sidebarRight/tabs/sharedMedia.ts
+++ b/src/components/sidebarRight/tabs/sharedMedia.ts
@@ -29,12 +29,12 @@ import PeerProfile from "../../peerProfile";
export default class AppSharedMediaTab extends SliderSuperTab {
private editBtn: HTMLElement;
- private peerId = 0;
+ private peerId: PeerId;
private threadId = 0;
private historiesStorage: {
- [peerId: number]: Partial<{
- [type in SearchSuperType]: {mid: number, peerId: number}[]
+ [peerId: PeerId]: Partial<{
+ [type in SearchSuperType]: {mid: number, peerId: PeerId}[]
}>
} = {};
@@ -124,7 +124,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
attachClickEvent(this.editBtn, (e) => {
let tab: AppEditChatTab | AppEditContactTab;
- if(this.peerId < 0) {
+ if(this.peerId.isAnyChat()) {
tab = new AppEditChatTab(this.slider);
} else {
tab = new AppEditContactTab(this.slider);
@@ -132,7 +132,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
if(tab) {
if(tab instanceof AppEditChatTab) {
- tab.chatId = -this.peerId;
+ tab.chatId = this.peerId.toChatId();
} else {
tab.peerId = this.peerId;
}
@@ -148,14 +148,14 @@ export default class AppSharedMediaTab extends SliderSuperTab {
});
rootScope.addEventListener('chat_update', (chatId) => {
- if(this.peerId === -chatId) {
+ if(this.peerId === chatId.toPeerId(true)) {
this.toggleEditBtn();
}
});
rootScope.addEventListener('history_multiappend', (msgIdsByPeer) => {
for(const peerId in msgIdsByPeer) {
- this.renderNewMessages(+peerId, Array.from(msgIdsByPeer[peerId]));
+ this.renderNewMessages(peerId.toPeerId(), Array.from(msgIdsByPeer[peerId]));
}
});
@@ -211,10 +211,11 @@ export default class AppSharedMediaTab extends SliderSuperTab {
this.content.append(btnAddMembers);
btnAddMembers.addEventListener('click', () => {
- const id = -this.peerId;
+ const peerId = this.peerId;
+ const id = this.peerId.toChatId();
const isChannel = appChatsManager.isChannel(id);
- const showConfirmation = (peerIds: number[], callback: (checked: PopupPeerButtonCallbackCheckboxes) => void) => {
+ const showConfirmation = (peerIds: PeerId[], callback: (checked: PopupPeerButtonCallbackCheckboxes) => void) => {
let titleLangKey: LangPackKey, titleLangArgs: any[],
descriptionLangKey: LangPackKey, descriptionLangArgs: any[],
checkboxes: PopupPeerCheckboxOptions[];
@@ -254,11 +255,11 @@ export default class AppSharedMediaTab extends SliderSuperTab {
}
descriptionLangArgs.push(new PeerTitle({
- peerId: -id
+ peerId
}).element);
new PopupPeer('popup-add-members', {
- peerId: -id,
+ peerId,
titleLangKey,
descriptionLangKey,
descriptionLangArgs,
@@ -279,7 +280,6 @@ export default class AppSharedMediaTab extends SliderSuperTab {
if(isChannel) {
const tab = new AppAddMembersTab(this.slider);
tab.open({
- peerId: this.peerId,
type: 'channel',
skippable: false,
takeOut: (peerIds) => {
@@ -313,7 +313,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
//console.log('construct shared media time:', performance.now() - perf);
}
- public renderNewMessages(peerId: number, mids: number[]) {
+ public renderNewMessages(peerId: PeerId, mids: number[]) {
if(this.init) return; // * not inited yet
if(!this.historiesStorage[peerId]) return;
@@ -336,7 +336,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
}
}
- public deleteDeletedMessages(peerId: number, mids: number[]) {
+ public deleteDeletedMessages(peerId: PeerId, mids: number[]) {
if(this.init) return; // * not inited yet
if(!this.historiesStorage[peerId]) return;
@@ -384,7 +384,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
this.searchSuper.cleanupHTML(true);
- this.container.classList.toggle('can-add-members', this.searchSuper.canViewMembers() && appChatsManager.hasRights(-this.peerId, 'invite_users'));
+ this.container.classList.toggle('can-add-members', this.searchSuper.canViewMembers() && appChatsManager.hasRights(this.peerId.toChatId(), 'invite_users'));
// console.log('cleanupHTML shared media time:', performance.now() - perf);
}
@@ -393,7 +393,7 @@ export default class AppSharedMediaTab extends SliderSuperTab {
this.searchSuper.loadMutex = promise;
}
- public setPeer(peerId: number, threadId = 0) {
+ public setPeer(peerId: PeerId, threadId = 0) {
if(this.peerId === peerId && this.threadId === threadId) return false;
this.peerId = peerId;
@@ -432,10 +432,10 @@ export default class AppSharedMediaTab extends SliderSuperTab {
private toggleEditBtn() {
let show: boolean;
- if(this.peerId > 0) {
+ if(this.peerId.isUser()) {
show = this.peerId !== rootScope.myId && appUsersManager.isContact(this.peerId);
} else {
- show = appChatsManager.hasRights(-this.peerId, 'change_info');
+ show = appChatsManager.hasRights(this.peerId.toChatId(), 'change_info');
}
this.editBtn.classList.toggle('hide', !show);
diff --git a/src/components/sidebarRight/tabs/stickers.ts b/src/components/sidebarRight/tabs/stickers.ts
index e50d418c..54508abf 100644
--- a/src/components/sidebarRight/tabs/stickers.ts
+++ b/src/components/sidebarRight/tabs/stickers.ts
@@ -181,8 +181,8 @@ export default class AppStickersTab extends SliderSuperTab {
div.addEventListener('mouseover', onMouseOver, {once: true}); */
- div.dataset.stickerSet = set.id;
- div.dataset.access_hash = set.access_hash;
+ div.dataset.stickerSet = '' + set.id;
+ div.dataset.access_hash = '' + set.access_hash;
div.dataset.title = set.title;
div.append(header, stickersDiv);
diff --git a/src/components/sidebarRight/tabs/userPermissions.ts b/src/components/sidebarRight/tabs/userPermissions.ts
index 8db5f6bf..1187cf26 100644
--- a/src/components/sidebarRight/tabs/userPermissions.ts
+++ b/src/components/sidebarRight/tabs/userPermissions.ts
@@ -18,8 +18,8 @@ import { ChatPermissions } from "./groupPermissions";
export default class AppUserPermissionsTab extends SliderSuperTabEventable {
public participant: ChannelParticipant;
- public chatId: number;
- public userId: number;
+ public chatId: ChatId;
+ public userId: UserId;
protected init() {
this.container.classList.add('edit-peer-container', 'user-permissions-container');
@@ -40,7 +40,7 @@ export default class AppUserPermissionsTab extends SliderSuperTabEventable {
div.append(list);
const {dom} = appDialogsManager.addDialogNew({
- dialog: this.userId,
+ dialog: this.userId.toPeerId(false),
container: list,
drawStatus: false,
rippleEnabled: true,
diff --git a/src/components/slider.ts b/src/components/slider.ts
index 8773c909..d735903c 100644
--- a/src/components/slider.ts
+++ b/src/components/slider.ts
@@ -10,6 +10,7 @@ import appNavigationController, { NavigationItem } from "./appNavigationControll
import SliderSuperTab, { SliderSuperTabConstructable, SliderTab } from "./sliderTab";
import { safeAssign } from "../helpers/object";
import { attachClickEvent } from "../helpers/dom/clickEvent";
+import { indexOfAndSplice } from "../helpers/array";
const TRANSITION_TIME = 250;
@@ -110,7 +111,7 @@ export default class SidebarSlider {
}
public removeTabFromHistory(id: number | SliderSuperTab) {
- this.historyTabIds.findAndSplice(i => i === id);
+ indexOfAndSplice(this.historyTabIds, id);
this.onCloseTab(id, undefined);
}
diff --git a/src/components/swipeHandler.ts b/src/components/swipeHandler.ts
index e6144073..6309de5a 100644
--- a/src/components/swipeHandler.ts
+++ b/src/components/swipeHandler.ts
@@ -20,6 +20,17 @@ rootScope.addEventListener('context_menu_toggle', (visible) => {
RESET_GLOBAL = visible;
});
+export type SwipeHandlerOptions = {
+ element: SwipeHandler['element'],
+ onSwipe: SwipeHandler['onSwipe'],
+ verifyTouchTarget?: SwipeHandler['verifyTouchTarget'],
+ onFirstSwipe?: SwipeHandler['onFirstSwipe'],
+ onReset?: SwipeHandler['onReset'],
+ cursor?: SwipeHandler['cursor'],
+ cancelEvent?: SwipeHandler['cancelEvent'],
+ listenerOptions?: SwipeHandler['listenerOptions']
+};
+
export default class SwipeHandler {
private element: HTMLElement;
private onSwipe: (xDiff: number, yDiff: number, e: TouchEvent | MouseEvent) => boolean | void;
@@ -28,20 +39,13 @@ export default class SwipeHandler {
private onReset: () => void;
private cursor: 'grabbing' | 'move' = 'grabbing';
private cancelEvent = true;
+ private listenerOptions: boolean | AddEventListenerOptions = false;
private hadMove = false;
private xDown: number = null;
private yDown: number = null;
- constructor(options: {
- element: SwipeHandler['element'],
- onSwipe: SwipeHandler['onSwipe'],
- verifyTouchTarget?: SwipeHandler['verifyTouchTarget'],
- onFirstSwipe?: SwipeHandler['onFirstSwipe'],
- onReset?: SwipeHandler['onReset'],
- cursor?: SwipeHandler['cursor'],
- cancelEvent?: SwipeHandler['cancelEvent']
- }) {
+ constructor(options: SwipeHandlerOptions) {
safeAssign(this, options);
this.setListeners();
@@ -49,20 +53,20 @@ export default class SwipeHandler {
public setListeners() {
if(!IS_TOUCH_SUPPORTED) {
- this.element.addEventListener('mousedown', this.handleStart, false);
+ this.element.addEventListener('mousedown', this.handleStart, this.listenerOptions);
attachGlobalListenerTo.addEventListener('mouseup', this.reset);
} else {
- this.element.addEventListener('touchstart', this.handleStart, false);
+ this.element.addEventListener('touchstart', this.handleStart, this.listenerOptions);
attachGlobalListenerTo.addEventListener('touchend', this.reset);
}
}
public removeListeners() {
if(!IS_TOUCH_SUPPORTED) {
- this.element.removeEventListener('mousedown', this.handleStart, false);
+ this.element.removeEventListener('mousedown', this.handleStart, this.listenerOptions);
attachGlobalListenerTo.removeEventListener('mouseup', this.reset);
} else {
- this.element.removeEventListener('touchstart', this.handleStart, false);
+ this.element.removeEventListener('touchstart', this.handleStart, this.listenerOptions);
attachGlobalListenerTo.removeEventListener('touchend', this.reset);
}
}
diff --git a/src/components/usernameInputField.ts b/src/components/usernameInputField.ts
index b3d763cc..f89bbb96 100644
--- a/src/components/usernameInputField.ts
+++ b/src/components/usernameInputField.ts
@@ -16,7 +16,7 @@ export class UsernameInputField extends InputField {
private checkUsernamePromise: Promise;
private checkUsernameDebounced: (username: string) => void;
public options: InputFieldOptions & {
- peerId: number,
+ peerId?: PeerId,
listenerSetter: ListenerSetter,
onChange?: () => void,
invalidText: LangPackKey,
@@ -68,7 +68,7 @@ export class UsernameInputField extends InputField {
if(this.options.peerId) {
this.checkUsernamePromise = apiManager.invokeApi('channels.checkUsername', {
- channel: appChatsManager.getChannelInput(-this.options.peerId),
+ channel: appChatsManager.getChannelInput(this.options.peerId.toChatId()),
username
});
} else {
diff --git a/src/components/wrappers.ts b/src/components/wrappers.ts
index 8bb5bdfc..8644bd07 100644
--- a/src/components/wrappers.ts
+++ b/src/components/wrappers.ts
@@ -570,7 +570,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
let docDiv = document.createElement('div');
docDiv.classList.add('document', `ext-${ext}`);
- docDiv.dataset.docId = doc.id;
+ docDiv.dataset.docId = '' + doc.id;
const icoDiv = document.createElement('div');
icoDiv.classList.add('document-ico');
@@ -580,7 +580,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
docDiv.classList.add('document-with-thumb');
let imgs: HTMLImageElement[] = [];
- if(message.pFlags.is_outgoing) {
+ if(uploading) {
icoDiv.innerHTML = ``;
imgs.push(icoDiv.firstElementChild as HTMLImageElement);
} else {
@@ -640,9 +640,9 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
docDiv.prepend(icoDiv);
- if(!uploading && message.pFlags.is_outgoing) {
+ /* if(!uploading && message.pFlags.is_outgoing) {
return docDiv;
- }
+ } */
let downloadDiv: HTMLElement, preloader: ProgressivePreloader = null;
const onLoad = () => {
@@ -1133,7 +1133,7 @@ export function wrapSticker({doc, div, middleware, lazyLoadQueue, group, play, o
throw new Error('wrong doc for wrapSticker!');
}
- div.dataset.docId = doc.id;
+ div.dataset.docId = '' + doc.id;
div.classList.add('media-sticker-wrapper');
//console.log('wrap sticker', doc, div, onlyThumb);
@@ -1185,7 +1185,7 @@ export function wrapSticker({doc, div, middleware, lazyLoadQueue, group, play, o
renderImageFromUrl(thumbImage, appPhotosManager.getPreviewURLFromThumb(doc, thumb as PhotoSize.photoStrippedSize, true), afterRender);
haveThumbCached = true;
} else {
- webpWorkerController.convert(doc.id, (thumb as PhotoSize.photoStrippedSize).bytes as Uint8Array).then(bytes => {
+ webpWorkerController.convert('' + doc.id, (thumb as PhotoSize.photoStrippedSize).bytes as Uint8Array).then(bytes => {
(thumb as PhotoSize.photoStrippedSize).bytes = bytes;
doc.pFlags.stickerThumbConverted = true;
@@ -1594,6 +1594,7 @@ export function wrapAlbum({groupId, attachmentDiv, middleware, uploading, lazyLo
const div = attachmentDiv.children[idx] as HTMLElement;
div.dataset.mid = '' + message.mid;
+ div.dataset.peerId = '' + message.peerId;
const mediaDiv = div.firstElementChild as HTMLElement;
if(media._ === 'photo') {
wrapPhoto({
diff --git a/src/config/app.ts b/src/config/app.ts
index be231dba..90f1d76d 100644
--- a/src/config/app.ts
+++ b/src/config/app.ts
@@ -18,7 +18,8 @@ const App = {
hash: process.env.API_HASH,
version: process.env.VERSION,
versionFull: process.env.VERSION_FULL,
- langPackVersion: '0.3.3',
+ build: +process.env.BUILD,
+ langPackVersion: '0.3.5',
langPack: 'macos',
langPackCode: 'en',
domains: [MAIN_DOMAIN] as string[],
diff --git a/src/global.d.ts b/src/global.d.ts
index cdba7a96..63a88692 100644
--- a/src/global.d.ts
+++ b/src/global.d.ts
@@ -1,4 +1,5 @@
import type ListenerSetter from "./helpers/listenerSetter";
+import type { Chat, Document, User } from "./layer";
declare global {
interface AddEventListenerOptions extends EventListenerOptions {
@@ -7,6 +8,24 @@ declare global {
// ls?: ListenerSetter;
}
+ type UserId = User.user['id'];
+ type ChatId = Chat.chat['id'];
+ // type PeerId = `u${UserId}` | `c${ChatId}`;
+ // type PeerId = `${UserId}` | `-${ChatId}`;
+ type PeerId = number;
+ // type PeerId = number;
+ type BotId = UserId;
+ type DocId = Document.document['id'];
+ type Long = string | number;
+ type MTLong = string;
+
+ type LocalErrorType = 'DOWNLOAD_CANCELED';
+ type ServerErrorType = 'FILE_REFERENCE_EXPIRED';
+
+ interface Error {
+ type?: LocalErrorType | ServerErrorType;
+ }
+
declare module 'worker-loader!*' {
class WebpackWorker extends Worker {
constructor();
diff --git a/src/helpers/array.ts b/src/helpers/array.ts
index a83cf4b4..106d6222 100644
--- a/src/helpers/array.ts
+++ b/src/helpers/array.ts
@@ -21,6 +21,12 @@ export function listMergeSorted(list1: any[] = [], list2: any[] = []) {
export const accumulate = (arr: number[], initialValue: number) => arr.reduce((acc, value) => acc + value, initialValue);
+export function indexOfAndSplice(array: Array, item: T) {
+ const idx = array.indexOf(item);
+ const spliced = idx !== -1 && array.splice(idx, 1);
+ return spliced && spliced[0];
+}
+
export function findAndSpliceAll(array: Array, verify: (value: T, index: number, arr: typeof array) => boolean) {
const out: typeof array = [];
let idx = -1;
diff --git a/src/helpers/avatarListLoader.ts b/src/helpers/avatarListLoader.ts
index 99112507..af7da474 100644
--- a/src/helpers/avatarListLoader.ts
+++ b/src/helpers/avatarListLoader.ts
@@ -4,17 +4,18 @@
* https://github.com/morethanwords/tweb/blob/master/LICENSE
*/
+import { Photo } from "../layer";
import appPhotosManager from "../lib/appManagers/appPhotosManager";
import ListLoader, { ListLoaderOptions } from "./listLoader";
-export default class AvatarListLoader- extends ListLoader
- {
- private peerId: number;
+export default class AvatarListLoader
- extends ListLoader
- {
+ private peerId: PeerId;
- constructor(options: Omit, 'loadMore'> & {peerId: number}) {
+ constructor(options: Omit, 'loadMore'> & {peerId: PeerId}) {
super({
...options,
loadMore: (anchor, older, loadCount) => {
- if(this.peerId < 0 || !older) return Promise.resolve({count: 0, items: []}); // ! это значит, что открыло аватар чата, но следующих фотографий нет.
+ if(this.peerId.isAnyChat() || !older) return Promise.resolve({count: 0, items: []}); // ! это значит, что открыло аватар чата, но следующих фотографий нет.
const maxId = anchor?.photoId;
return appPhotosManager.getUserPhotos(this.peerId, maxId, loadCount).then(value => {
diff --git a/src/helpers/compareVersion.ts b/src/helpers/compareVersion.ts
new file mode 100644
index 00000000..35aa6e54
--- /dev/null
+++ b/src/helpers/compareVersion.ts
@@ -0,0 +1,15 @@
+export default function compareVersion(v1: string, v2: string): number {
+ v1 = v1.split(' ', 1)[0];
+ v2 = v2.split(' ', 1)[0];
+ const s1 = v1.split('.');
+ const s2 = v2.split('.');
+
+ for(let i = 0; i < s1.length; ++i) {
+ const v1 = +s1[i];
+ const v2 = +s2[i];
+ if(v1 > v2) return 1;
+ else if(v1 < v2) return -1;
+ }
+
+ return 0;
+}
diff --git a/src/helpers/dom/getRichElementValue.ts b/src/helpers/dom/getRichElementValue.ts
index 39404d99..8ef37dcf 100644
--- a/src/helpers/dom/getRichElementValue.ts
+++ b/src/helpers/dom/getRichElementValue.ts
@@ -77,7 +77,7 @@ export default function getRichElementValue(node: HTMLElement, lines: string[],
_: tag.entityName,
offset: offset.offset,
length: nodeValue.length,
- user_id: +parentElement.dataset.follow
+ user_id: parentElement.dataset.follow
});
} else {
entities.push({
diff --git a/src/helpers/dom/handleHorizontalSwipe.ts b/src/helpers/dom/handleHorizontalSwipe.ts
new file mode 100644
index 00000000..a90faefa
--- /dev/null
+++ b/src/helpers/dom/handleHorizontalSwipe.ts
@@ -0,0 +1,50 @@
+/*
+ * https://github.com/morethanwords/tweb
+ * Copyright (C) 2019-2021 Eduard Kuzmenko
+ * https://github.com/morethanwords/tweb/blob/master/LICENSE
+ */
+
+import SwipeHandler, { SwipeHandlerOptions } from "../../components/swipeHandler";
+import { IS_APPLE_MOBILE, IS_SAFARI } from "../../environment/userAgent";
+import { cancelEvent } from "./cancelEvent";
+import findUpClassName from "./findUpClassName";
+import isSwipingBackSafari from "./isSwipingBackSafari";
+
+export type SwipeHandlerHorizontalOptions = SwipeHandlerOptions & {
+ // xThreshold?: number
+};
+
+export default function handleHorizontalSwipe(options: SwipeHandlerHorizontalOptions) {
+ let cancelY = false;
+ return new SwipeHandler({
+ ...options,
+ verifyTouchTarget: (e) => {
+ return !findUpClassName(e.target, 'progress-line') &&
+ !isSwipingBackSafari(e) &&
+ (options.verifyTouchTarget ? options.verifyTouchTarget(e) : true);
+ },
+ onSwipe: (xDiff, yDiff, e) => {
+ if(!cancelY && Math.abs(yDiff) > 20) {
+ return true;
+ }
+
+ if(Math.abs(xDiff) > Math.abs(yDiff)) {
+ cancelEvent(e);
+ cancelY = true;
+ } else if(!cancelY && Math.abs(yDiff) > Math.abs(xDiff)/* || Math.abs(yDiff) > 20 */) {
+ return true;
+ }
+
+ /* if(!cancelY && options.xThreshold !== undefined && xDiff >= options.xThreshold) {
+ cancelY = true;
+ } */
+
+ return options.onSwipe(xDiff, yDiff, e);
+ },
+ onReset: () => {
+ cancelY = false;
+ options.onReset && options.onReset();
+ },
+ cancelEvent: true
+ });
+}
diff --git a/src/helpers/dom/handleTabSwipe.ts b/src/helpers/dom/handleTabSwipe.ts
index 41be7dd5..67975f51 100644
--- a/src/helpers/dom/handleTabSwipe.ts
+++ b/src/helpers/dom/handleTabSwipe.ts
@@ -5,52 +5,18 @@
*/
import { cancelContextMenuOpening } from "../../components/misc";
-import SwipeHandler from "../../components/swipeHandler";
-import { cancelEvent } from "./cancelEvent";
+import handleHorizontalSwipe, { SwipeHandlerHorizontalOptions } from "./handleHorizontalSwipe";
-export default function handleTabSwipe(container: HTMLElement, onSwipe: (next: boolean) => void) {
- /* let hadScroll = false;
- const onScroll = () => {
- swipeHandler.reset();
- };
- let firstSwipeChecked = false; */
- return new SwipeHandler({
- element: container,
- /* onFirstSwipe: () => {
- this.scroll.container.addEventListener('scroll', onScroll, {passive: true});
- }, */
+export default function handleTabSwipe(options: SwipeHandlerHorizontalOptions) {
+ return handleHorizontalSwipe({
+ ...options,
onSwipe: (xDiff, yDiff, e) => {
- /* if(!firstSwipeChecked) {
- firstSwipeChecked = true;
- if(yDiff !== 0) {
- return true;
- }
- }
-
- cancelEvent(e); */
-
- if(Math.abs(yDiff) > 20) {
- return true;
- }
-
- if(Math.abs(xDiff) > Math.abs(yDiff)) {
- cancelEvent(e);
- } else if(Math.abs(yDiff) > Math.abs(xDiff)/* || Math.abs(yDiff) > 20 */) {
- return true;
- }
-
if(Math.abs(xDiff) > 50) {
- onSwipe(xDiff > 0);
+ options.onSwipe(xDiff, yDiff, e);
cancelContextMenuOpening();
return true;
}
- },
- /* onReset: () => {
- hadScroll = false;
- firstSwipeChecked = false;
- this.scroll.container.removeEventListener('scroll', onScroll);
- }, */
- cancelEvent: false
+ }
});
-}
\ No newline at end of file
+}
diff --git a/src/helpers/dom/isSwipingBackSafari.ts b/src/helpers/dom/isSwipingBackSafari.ts
new file mode 100644
index 00000000..66e4dc7a
--- /dev/null
+++ b/src/helpers/dom/isSwipingBackSafari.ts
@@ -0,0 +1,11 @@
+/*
+ * https://github.com/morethanwords/tweb
+ * Copyright (C) 2019-2021 Eduard Kuzmenko
+ * https://github.com/morethanwords/tweb/blob/master/LICENSE
+ */
+
+import { IS_MOBILE_SAFARI } from "../../environment/userAgent";
+
+export default function isSwipingBackSafari(e: TouchEvent | MouseEvent) {
+ return IS_MOBILE_SAFARI && e instanceof TouchEvent && e.touches[0].clientX < 30;
+}
diff --git a/src/helpers/dom/lockTouchScroll.ts b/src/helpers/dom/lockTouchScroll.ts
new file mode 100644
index 00000000..4a7f8c13
--- /dev/null
+++ b/src/helpers/dom/lockTouchScroll.ts
@@ -0,0 +1,25 @@
+/*
+ * https://github.com/morethanwords/tweb
+ * Copyright (C) 2019-2021 Eduard Kuzmenko
+ * https://github.com/morethanwords/tweb/blob/master/LICENSE
+ */
+
+import { cancelEvent } from "./cancelEvent";
+
+export default function lockTouchScroll(container: HTMLElement) {
+ const onTouchMove = (e: TouchEvent) => {
+ cancelEvent(e);
+ };
+
+ let lockers = 2;
+ const cb = () => {
+ if(!--lockers) {
+ container.removeEventListener('touchmove', onTouchMove, {capture: true});
+ }
+ };
+
+ container.addEventListener('touchmove', onTouchMove, {capture: true, passive: false});
+ container.addEventListener('touchend', cb, {once: true});
+
+ return cb;
+}
diff --git a/src/helpers/object.ts b/src/helpers/object.ts
index 19e2ee56..17cebeff 100644
--- a/src/helpers/object.ts
+++ b/src/helpers/object.ts
@@ -46,10 +46,10 @@ export function deepEqual(x: any, y: any): boolean {
) : (x === y);
}
-export function defineNotNumerableProperties(obj: {[key: string]: any}, names: string[]) {
+export function defineNotNumerableProperties(obj: T, names: (keyof T)[]) {
//const perf = performance.now();
const props = {writable: true, configurable: true};
- const out: {[name: string]: typeof props} = {};
+ const out: {[name in keyof T]?: typeof props} = {};
names.forEach(name => {
if(obj[name] === undefined) {
out[name] = props;
@@ -108,7 +108,7 @@ export function safeReplaceArrayInObject(key: K, wasObject: any, newObject: a
}
}
-export function isObject(object: any) {
+export function isObject>(object: any): object is T {
return typeof(object) === 'object' && object !== null;
}
diff --git a/src/helpers/peerIdPolyfill.ts b/src/helpers/peerIdPolyfill.ts
new file mode 100644
index 00000000..eca8dd44
--- /dev/null
+++ b/src/helpers/peerIdPolyfill.ts
@@ -0,0 +1,55 @@
+/*
+ * https://github.com/morethanwords/tweb
+ * Copyright (C) 2019-2021 Eduard Kuzmenko
+ * https://github.com/morethanwords/tweb/blob/master/LICENSE
+ */
+
+String.prototype.toUserId = function() {
+ return (+this).toUserId();
+};
+
+String.prototype.toChatId = function() {
+ return (+this).toChatId();
+};
+
+String.prototype.toPeerId = function(isChat?: boolean) {
+ return (+this).toPeerId(isChat);
+};
+
+String.prototype.isPeerId = function() {
+ return /^[\d-]/.test(this.toString());
+};
+
+Number.prototype.toUserId = function() {
+ return this as any;
+};
+
+Number.prototype.toChatId = function() {
+ return -this;
+};
+
+Number.prototype.toPeerId = function(isChat?: boolean) {
+ return isChat === undefined ? this as number : (isChat ? -Math.abs(this as number) : this as number);
+};
+
+Number.prototype.isPeerId = function() {
+ return true;
+};
+
+declare global {
+ interface String {
+ toUserId(): UserId;
+ toChatId(): ChatId;
+ toPeerId(isChat?: boolean): PeerId;
+ isPeerId(): this is string;
+ }
+
+ interface Number {
+ toUserId(): UserId;
+ toChatId(): ChatId;
+ toPeerId(isChat?: boolean): PeerId;
+ isPeerId(): this is PeerId;
+ }
+}
+
+export {};
diff --git a/src/helpers/searchListLoader.ts b/src/helpers/searchListLoader.ts
index de0c3a6e..f80f07a0 100644
--- a/src/helpers/searchListLoader.ts
+++ b/src/helpers/searchListLoader.ts
@@ -8,13 +8,13 @@ import type { MediaSearchContext } from "../components/appMediaPlaybackControlle
import type { SearchSuperContext } from "../components/appSearchSuper.";
import type { Message } from "../layer";
import appMessagesIdsManager from "../lib/appManagers/appMessagesIdsManager";
-import appMessagesManager from "../lib/appManagers/appMessagesManager";
+import appMessagesManager, { MyMessage } from "../lib/appManagers/appMessagesManager";
import rootScope from "../lib/rootScope";
import { forEachReverse } from "./array";
import filterChatPhotosMessages from "./filterChatPhotosMessages";
import ListLoader, { ListLoaderOptions } from "./listLoader";
-export default class SearchListLoader
- extends ListLoader
- {
+export default class SearchListLoader
- extends ListLoader
- {
public searchContext: MediaSearchContext;
public onEmptied: () => void;
@@ -73,7 +73,7 @@ export default class SearchListLoader
- }) => {
+ protected onHistoryDelete = ({peerId, msgs}: {peerId: PeerId, msgs: Set}) => {
const shouldBeDeleted = (item: Item) => item.peerId === peerId && msgs.has(item.mid);
const filter = (item: Item, idx: number, arr: Item[]) => {
if(shouldBeDeleted(item)) {
@@ -120,7 +120,7 @@ export default class SearchListLoader
- {
+ protected onMessageSent = ({message}: {message: MyMessage}) => {
this.onHistoryMultiappend({
[message.peerId]: new Set([message.mid])
});
diff --git a/src/helpers/sortedList.ts b/src/helpers/sortedList.ts
index 557bba96..37987033 100644
--- a/src/helpers/sortedList.ts
+++ b/src/helpers/sortedList.ts
@@ -8,16 +8,17 @@ import { insertInDescendSortedArray } from "./array";
import { getMiddleware } from "./middleware";
import { safeAssign } from "./object";
+export type SortedElementId = PeerId;
export type SortedElementBase = {
- id: number,
+ id: SortedElementId,
index: number
};
export default class SortedList {
- protected elements: Map;
+ protected elements: Map;
protected sorted: Array;
- protected getIndex: (id: number) => number;
+ protected getIndex: (id: SortedElementId) => number;
protected onDelete: (element: SortedElement) => void;
protected onUpdate: (element: SortedElement) => void;
protected onSort: (element: SortedElement, idx: number) => void;
@@ -75,11 +76,11 @@ export default class SortedList {
});
}
- public has(id: number) {
+ public has(id: SortedElementId) {
return this.elements.has(id);
}
- public get(id: number) {
+ public get(id: SortedElementId) {
return this.elements.get(id);
}
@@ -87,7 +88,7 @@ export default class SortedList {
return this.elements;
}
- public add(id: number, batch = false, updateElementWith?: SortedList['updateElementWith'], updateBatch = batch) {
+ public add(id: SortedElementId, batch = false, updateElementWith?: SortedList['updateElementWith'], updateBatch = batch) {
let element = this.get(id);
if(element) {
return element;
@@ -105,7 +106,7 @@ export default class SortedList {
return element;
}
- public delete(id: number, noScheduler?: boolean) {
+ public delete(id: SortedElementId, noScheduler?: boolean) {
const element = this.elements.get(id);
if(!element) {
return false;
@@ -136,7 +137,7 @@ export default class SortedList {
return true;
}
- public update(id: number, batch = false, element = this.get(id), updateElementWith?: SortedList['updateElementWith']) {
+ public update(id: SortedElementId, batch = false, element = this.get(id), updateElementWith?: SortedList['updateElementWith']) {
if(!element) {
return;
}
diff --git a/src/index.ts b/src/index.ts
index bf76910d..e884c0b0 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -99,13 +99,14 @@ console.timeEnd('get storage1'); */
const workerProxy = new Proxy(Worker, workerHandler);
Worker = workerProxy;
- const [_, touchSupport, userAgent, rootScope, appStateManager, I18n] = await Promise.all([
+ const [_, touchSupport, userAgent, rootScope, appStateManager, I18n, __] = await Promise.all([
import('./lib/polyfill'),
import('./environment/touchSupport'),
import('./environment/userAgent'),
import('./lib/rootScope'),
import('./lib/appManagers/appStateManager'),
import('./lib/langPack'),
+ import('./helpers/peerIdPolyfill'),
]);
//console.timeEnd('get storage');
diff --git a/src/lang.ts b/src/lang.ts
index 2787b72c..b72114da 100644
--- a/src/lang.ts
+++ b/src/lang.ts
@@ -134,6 +134,7 @@ const lang = {
"PushNotification.Action.Mute1d.Mobile": "Mute for 24H",
"PushNotification.Action.Settings.Mobile": "Alerts settings",
"PushNotification.Message.NoPreview": "You have a new message",
+ "LogOut.Description": "Are you sure you want to log out?\n\nNote that you can seamlessly use Telegram on all your devices at once.",
//"PushNotification.Action.Mute1d.Success": "Notification settings were successfully saved.",
// * android
@@ -586,6 +587,7 @@ const lang = {
"UserUnblocked": "User unblocked",
"AudioUnknownArtist": "Unknown artist",
"AudioUnknownTitle": "Unknown title",
+ "LogOut": "Log out",
// * macos
"AccountSettings.Filters": "Chat Folders",
@@ -593,6 +595,7 @@ const lang = {
"AccountSettings.PrivacyAndSecurity": "Privacy and Security",
"AccountSettings.Language": "Language",
"Alert.UserDoesntExists": "Sorry, this user doesn't seem to exist.",
+ "Alert.Confirm.Discard": "Discard",
"Appearance.Reset": "Reset to Defaults",
"Bio.Description": "Any details such as age, occupation or city.\nExample: 23 y.o. designer from San Francisco",
"Contacts.PhoneNumber.NotRegistred": "The person with this phone number is not registered on Telegram yet.",
@@ -605,6 +608,7 @@ const lang = {
"Chat.DropTitle": "Drop files here to send them",
"Chat.DropQuickDesc": "in a quick way",
"Chat.DropAsFilesDesc": "without compression",
+ "Chat.Edit.Cancel.Text": "Are you sure you want to discard all changes?",
"Chat.Service.PeerJoinedTelegram": "%@ joined Telegram",
"Chat.Service.Channel.UpdatedTitle": "Channel renamed to \"%@\"",
"Chat.Service.Channel.UpdatedPhoto": "Channel photo updated",
diff --git a/src/layer.d.ts b/src/layer.d.ts
index 9c1322f9..6a06f182 100644
--- a/src/layer.d.ts
+++ b/src/layer.d.ts
@@ -27,33 +27,33 @@ export namespace InputPeer {
export type inputPeerChat = {
_: 'inputPeerChat',
- chat_id: number
+ chat_id: string | number
};
export type inputPeerUser = {
_: 'inputPeerUser',
- user_id: number,
- access_hash: string
+ user_id: string | number,
+ access_hash: string | number
};
export type inputPeerChannel = {
_: 'inputPeerChannel',
- channel_id: number,
- access_hash: string
+ channel_id: string | number,
+ access_hash: string | number
};
export type inputPeerUserFromMessage = {
_: 'inputPeerUserFromMessage',
peer: InputPeer,
msg_id: number,
- user_id: number
+ user_id: string | number
};
export type inputPeerChannelFromMessage = {
_: 'inputPeerChannelFromMessage',
peer: InputPeer,
msg_id: number,
- channel_id: number
+ channel_id: string | number
};
}
@@ -73,15 +73,15 @@ export namespace InputUser {
export type inputUser = {
_: 'inputUser',
- user_id: number,
- access_hash: string
+ user_id: string | number,
+ access_hash: string | number
};
export type inputUserFromMessage = {
_: 'inputUserFromMessage',
peer: InputPeer,
msg_id: number,
- user_id: number
+ user_id: string | number
};
}
@@ -93,7 +93,7 @@ export type InputContact = InputContact.inputPhoneContact;
export namespace InputContact {
export type inputPhoneContact = {
_: 'inputPhoneContact',
- client_id: string,
+ client_id: string | number,
phone: string,
first_name: string,
last_name: string
@@ -108,7 +108,7 @@ export type InputFile = InputFile.inputFile | InputFile.inputFileBig;
export namespace InputFile {
export type inputFile = {
_: 'inputFile',
- id: string,
+ id: string | number,
parts: number,
name: string,
md5_checksum: string
@@ -116,7 +116,7 @@ export namespace InputFile {
export type inputFileBig = {
_: 'inputFileBig',
- id: string,
+ id: string | number,
parts: number,
name: string
};
@@ -158,7 +158,7 @@ export namespace InputMedia {
first_name: string,
last_name: string,
vcard: string,
- user_id?: number
+ user_id?: UserId
};
export type inputMediaUploadedDocument = {
@@ -308,8 +308,8 @@ export namespace InputPhoto {
export type inputPhoto = {
_: 'inputPhoto',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[]
};
}
@@ -322,22 +322,22 @@ export type InputFileLocation = InputFileLocation.inputFileLocation | InputFileL
export namespace InputFileLocation {
export type inputFileLocation = {
_: 'inputFileLocation',
- volume_id: string,
+ volume_id: string | number,
local_id: number,
- secret: string,
+ secret: string | number,
file_reference: Uint8Array | number[]
};
export type inputEncryptedFileLocation = {
_: 'inputEncryptedFileLocation',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputDocumentFileLocation = {
_: 'inputDocumentFileLocation',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[],
thumb_size: string,
checkedReference?: boolean
@@ -345,8 +345,8 @@ export namespace InputFileLocation {
export type inputSecureFileLocation = {
_: 'inputSecureFileLocation',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputTakeoutFileLocation = {
@@ -355,20 +355,20 @@ export namespace InputFileLocation {
export type inputPhotoFileLocation = {
_: 'inputPhotoFileLocation',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[],
thumb_size: string
};
export type inputPhotoLegacyFileLocation = {
_: 'inputPhotoLegacyFileLocation',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[],
- volume_id: string,
+ volume_id: string | number,
local_id: number,
- secret: string
+ secret: string | number
};
export type inputPeerPhotoFileLocation = {
@@ -378,7 +378,7 @@ export namespace InputFileLocation {
big?: true,
}>,
peer: InputPeer,
- photo_id: string
+ photo_id: string | number
};
export type inputStickerSetThumb = {
@@ -389,9 +389,12 @@ export namespace InputFileLocation {
export type inputGroupCallStream = {
_: 'inputGroupCallStream',
+ flags?: number,
call: InputGroupCall,
- time_ms: string,
- scale: number
+ time_ms: string | number,
+ scale: number,
+ video_channel?: number,
+ video_quality?: number
};
}
@@ -403,17 +406,17 @@ export type Peer = Peer.peerUser | Peer.peerChat | Peer.peerChannel;
export namespace Peer {
export type peerUser = {
_: 'peerUser',
- user_id: number
+ user_id: string | number
};
export type peerChat = {
_: 'peerChat',
- chat_id: number
+ chat_id: string | number
};
export type peerChannel = {
_: 'peerChannel',
- channel_id: number
+ channel_id: string | number
};
}
@@ -472,7 +475,7 @@ export type User = User.userEmpty | User.user;
export namespace User {
export type userEmpty = {
_: 'userEmpty',
- id: number
+ id: string | number
};
export type user = {
@@ -495,8 +498,8 @@ export namespace User {
apply_min_photo?: true,
fake?: true,
}>,
- id: number,
- access_hash?: string,
+ id: string | number,
+ access_hash?: string | number,
first_name?: string,
last_name?: string,
username?: string,
@@ -528,7 +531,7 @@ export namespace UserProfilePhoto {
pFlags?: Partial<{
has_video?: true,
}>,
- photo_id: string,
+ photo_id: string | number,
stripped_thumb?: Uint8Array,
dc_id: number
};
@@ -575,7 +578,7 @@ export type Chat = Chat.chatEmpty | Chat.chat | Chat.chatForbidden | Chat.channe
export namespace Chat {
export type chatEmpty = {
_: 'chatEmpty',
- id: number
+ id: string | number
};
export type chat = {
@@ -589,7 +592,7 @@ export namespace Chat {
call_active?: true,
call_not_empty?: true,
}>,
- id: number,
+ id: string | number,
title: string,
photo: ChatPhoto,
participants_count: number,
@@ -603,7 +606,7 @@ export namespace Chat {
export type chatForbidden = {
_: 'chatForbidden',
- id: number,
+ id: string | number,
title: string,
initials?: string
};
@@ -629,13 +632,12 @@ export namespace Chat {
fake?: true,
gigagroup?: true,
}>,
- id: number,
- access_hash?: string,
+ id: string | number,
+ access_hash?: string | number,
title: string,
username?: string,
photo: ChatPhoto,
date: number,
- version: number,
restriction_reason?: Array,
admin_rights?: ChatAdminRights,
banned_rights?: ChatBannedRights,
@@ -651,8 +653,8 @@ export namespace Chat {
broadcast?: true,
megagroup?: true,
}>,
- id: number,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
title: string,
until_date?: number,
initials?: string
@@ -672,7 +674,7 @@ export namespace ChatFull {
can_set_username?: true,
has_scheduled?: true,
}>,
- id: number,
+ id: string | number,
about: string,
participants: ChatParticipants,
chat_photo?: Photo,
@@ -683,7 +685,8 @@ export namespace ChatFull {
folder_id?: number,
call?: InputGroupCall,
ttl_period?: number,
- groupcall_default_join_as?: Peer
+ groupcall_default_join_as?: Peer,
+ theme_emoticon?: string
};
export type channelFull = {
@@ -699,7 +702,7 @@ export namespace ChatFull {
can_view_stats?: true,
blocked?: true,
}>,
- id: number,
+ id: string | number,
about: string,
participants_count?: number,
admins_count?: number,
@@ -713,13 +716,13 @@ export namespace ChatFull {
notify_settings: PeerNotifySettings,
exported_invite?: ExportedChatInvite,
bot_info: Array,
- migrated_from_chat_id?: number,
+ migrated_from_chat_id?: string | number,
migrated_from_max_id?: number,
pinned_msg_id?: number,
stickerset?: StickerSet,
available_min_id?: number,
folder_id?: number,
- linked_chat_id?: number,
+ linked_chat_id?: string | number,
location?: ChannelLocation,
slowmode_seconds?: number,
slowmode_next_send_date?: number,
@@ -728,7 +731,8 @@ export namespace ChatFull {
call?: InputGroupCall,
ttl_period?: number,
pending_suggestions?: Array,
- groupcall_default_join_as?: Peer
+ groupcall_default_join_as?: Peer,
+ theme_emoticon?: string
};
}
@@ -740,20 +744,20 @@ export type ChatParticipant = ChatParticipant.chatParticipant | ChatParticipant.
export namespace ChatParticipant {
export type chatParticipant = {
_: 'chatParticipant',
- user_id: number,
- inviter_id: number,
+ user_id: string | number,
+ inviter_id: string | number,
date: number
};
export type chatParticipantCreator = {
_: 'chatParticipantCreator',
- user_id: number
+ user_id: string | number
};
export type chatParticipantAdmin = {
_: 'chatParticipantAdmin',
- user_id: number,
- inviter_id: number,
+ user_id: string | number,
+ inviter_id: string | number,
date: number
};
}
@@ -767,13 +771,13 @@ export namespace ChatParticipants {
export type chatParticipantsForbidden = {
_: 'chatParticipantsForbidden',
flags?: number,
- chat_id: number,
+ chat_id: string | number,
self_participant?: ChatParticipant
};
export type chatParticipants = {
_: 'chatParticipants',
- chat_id: number,
+ chat_id: string | number,
participants: Array,
version: number
};
@@ -795,7 +799,7 @@ export namespace ChatPhoto {
pFlags?: Partial<{
has_video?: true,
}>,
- photo_id: string,
+ photo_id: string | number,
stripped_thumb?: Uint8Array,
dc_id: number
};
@@ -836,7 +840,7 @@ export namespace Message {
from_id?: Peer,
peer_id: Peer,
fwd_from?: MessageFwdHeader,
- via_bot_id?: number,
+ via_bot_id?: string | number,
reply_to?: MessageReplyHeader,
date: number,
message: string,
@@ -853,11 +857,12 @@ export namespace Message {
ttl_period?: number,
mid?: number,
deleted?: boolean,
- peerId?: number,
- fromId?: number,
+ peerId?: PeerId,
+ fromId?: PeerId,
+ fwdFromId?: PeerId,
random_id?: string,
rReply?: string,
- viaBotId?: number,
+ viaBotId?: PeerId,
clear_history?: boolean,
pending?: boolean,
error?: any,
@@ -888,10 +893,14 @@ export namespace Message {
ttl_period?: number,
mid?: number,
deleted?: boolean,
- peerId?: number,
- fromId?: number,
+ peerId?: PeerId,
+ fromId?: PeerId,
rReply?: string,
- viaBotId?: number
+ viaBotId?: PeerId,
+ pending?: boolean,
+ error?: any,
+ send?: () => Promise,
+ random_id?: string
};
}
@@ -923,7 +932,7 @@ export namespace MessageMedia {
first_name: string,
last_name: string,
vcard: string,
- user_id: number
+ user_id: string | number
};
export type messageMediaUnsupported = {
@@ -969,7 +978,7 @@ export namespace MessageMedia {
photo?: WebDocument,
receipt_msg_id?: number,
currency: string,
- total_amount: string,
+ total_amount: string | number,
start_param: string
};
@@ -998,7 +1007,7 @@ export namespace MessageMedia {
/**
* @link https://core.telegram.org/type/MessageAction
*/
-export type MessageAction = MessageAction.messageActionEmpty | MessageAction.messageActionChatCreate | MessageAction.messageActionChatEditTitle | MessageAction.messageActionChatEditPhoto | MessageAction.messageActionChatDeletePhoto | MessageAction.messageActionChatAddUser | MessageAction.messageActionChatDeleteUser | MessageAction.messageActionChatJoinedByLink | MessageAction.messageActionChannelCreate | MessageAction.messageActionChatMigrateTo | MessageAction.messageActionChannelMigrateFrom | MessageAction.messageActionPinMessage | MessageAction.messageActionHistoryClear | MessageAction.messageActionGameScore | MessageAction.messageActionPaymentSentMe | MessageAction.messageActionPaymentSent | MessageAction.messageActionPhoneCall | MessageAction.messageActionScreenshotTaken | MessageAction.messageActionCustomAction | MessageAction.messageActionBotAllowed | MessageAction.messageActionSecureValuesSentMe | MessageAction.messageActionSecureValuesSent | MessageAction.messageActionContactSignUp | MessageAction.messageActionGeoProximityReached | MessageAction.messageActionGroupCall | MessageAction.messageActionInviteToGroupCall | MessageAction.messageActionSetMessagesTTL | MessageAction.messageActionGroupCallScheduled | MessageAction.messageActionDiscussionStarted | MessageAction.messageActionChatLeave | MessageAction.messageActionChannelDeletePhoto | MessageAction.messageActionChannelEditTitle | MessageAction.messageActionChannelEditPhoto | MessageAction.messageActionChannelEditVideo | MessageAction.messageActionChatEditVideo | MessageAction.messageActionChatAddUsers | MessageAction.messageActionChatJoined | MessageAction.messageActionChatReturn | MessageAction.messageActionChatJoinedYou | MessageAction.messageActionChatReturnYou;
+export type MessageAction = MessageAction.messageActionEmpty | MessageAction.messageActionChatCreate | MessageAction.messageActionChatEditTitle | MessageAction.messageActionChatEditPhoto | MessageAction.messageActionChatDeletePhoto | MessageAction.messageActionChatAddUser | MessageAction.messageActionChatDeleteUser | MessageAction.messageActionChatJoinedByLink | MessageAction.messageActionChannelCreate | MessageAction.messageActionChatMigrateTo | MessageAction.messageActionChannelMigrateFrom | MessageAction.messageActionPinMessage | MessageAction.messageActionHistoryClear | MessageAction.messageActionGameScore | MessageAction.messageActionPaymentSentMe | MessageAction.messageActionPaymentSent | MessageAction.messageActionPhoneCall | MessageAction.messageActionScreenshotTaken | MessageAction.messageActionCustomAction | MessageAction.messageActionBotAllowed | MessageAction.messageActionSecureValuesSentMe | MessageAction.messageActionSecureValuesSent | MessageAction.messageActionContactSignUp | MessageAction.messageActionGeoProximityReached | MessageAction.messageActionGroupCall | MessageAction.messageActionInviteToGroupCall | MessageAction.messageActionSetMessagesTTL | MessageAction.messageActionGroupCallScheduled | MessageAction.messageActionSetChatTheme | MessageAction.messageActionDiscussionStarted | MessageAction.messageActionChatLeave | MessageAction.messageActionChannelDeletePhoto | MessageAction.messageActionChannelEditTitle | MessageAction.messageActionChannelEditPhoto | MessageAction.messageActionChannelEditVideo | MessageAction.messageActionChatEditVideo | MessageAction.messageActionChatAddUsers | MessageAction.messageActionChatJoined | MessageAction.messageActionChatReturn | MessageAction.messageActionChatJoinedYou | MessageAction.messageActionChatReturnYou;
export namespace MessageAction {
export type messageActionEmpty = {
@@ -1008,7 +1017,7 @@ export namespace MessageAction {
export type messageActionChatCreate = {
_: 'messageActionChatCreate',
title: string,
- users: Array
+ users: Array
};
export type messageActionChatEditTitle = {
@@ -1027,17 +1036,17 @@ export namespace MessageAction {
export type messageActionChatAddUser = {
_: 'messageActionChatAddUser',
- users: Array
+ users: Array
};
export type messageActionChatDeleteUser = {
_: 'messageActionChatDeleteUser',
- user_id: number
+ user_id: string | number
};
export type messageActionChatJoinedByLink = {
_: 'messageActionChatJoinedByLink',
- inviter_id: number
+ inviter_id: string | number
};
export type messageActionChannelCreate = {
@@ -1047,13 +1056,13 @@ export namespace MessageAction {
export type messageActionChatMigrateTo = {
_: 'messageActionChatMigrateTo',
- channel_id: number
+ channel_id: string | number
};
export type messageActionChannelMigrateFrom = {
_: 'messageActionChannelMigrateFrom',
title: string,
- chat_id: number
+ chat_id: string | number
};
export type messageActionPinMessage = {
@@ -1066,7 +1075,7 @@ export namespace MessageAction {
export type messageActionGameScore = {
_: 'messageActionGameScore',
- game_id: string,
+ game_id: string | number,
score: number
};
@@ -1074,7 +1083,7 @@ export namespace MessageAction {
_: 'messageActionPaymentSentMe',
flags?: number,
currency: string,
- total_amount: string,
+ total_amount: string | number,
payload: Uint8Array,
info?: PaymentRequestedInfo,
shipping_option_id?: string,
@@ -1084,7 +1093,7 @@ export namespace MessageAction {
export type messageActionPaymentSent = {
_: 'messageActionPaymentSent',
currency: string,
- total_amount: string
+ total_amount: string | number
};
export type messageActionPhoneCall = {
@@ -1093,7 +1102,7 @@ export namespace MessageAction {
pFlags?: Partial<{
video?: true,
}>,
- call_id: string,
+ call_id: string | number,
reason?: PhoneCallDiscardReason,
duration?: number
};
@@ -1144,7 +1153,7 @@ export namespace MessageAction {
export type messageActionInviteToGroupCall = {
_: 'messageActionInviteToGroupCall',
call: InputGroupCall,
- users: Array
+ users: Array
};
export type messageActionSetMessagesTTL = {
@@ -1158,13 +1167,18 @@ export namespace MessageAction {
schedule_date: number
};
+ export type messageActionSetChatTheme = {
+ _: 'messageActionSetChatTheme',
+ emoticon: string
+ };
+
export type messageActionDiscussionStarted = {
_: 'messageActionDiscussionStarted'
};
export type messageActionChatLeave = {
_: 'messageActionChatLeave',
- user_id?: number
+ user_id?: UserId
};
export type messageActionChannelDeletePhoto = {
@@ -1193,27 +1207,27 @@ export namespace MessageAction {
export type messageActionChatAddUsers = {
_: 'messageActionChatAddUsers',
- users?: Array
+ users?: Array
};
export type messageActionChatJoined = {
_: 'messageActionChatJoined',
- users?: Array
+ users?: Array
};
export type messageActionChatReturn = {
_: 'messageActionChatReturn',
- users?: Array
+ users?: Array
};
export type messageActionChatJoinedYou = {
_: 'messageActionChatJoinedYou',
- users?: Array
+ users?: Array
};
export type messageActionChatReturnYou = {
_: 'messageActionChatReturnYou',
- users?: Array
+ users?: Array
};
}
@@ -1252,9 +1266,9 @@ export namespace Dialog {
index_8?: number,
index_9?: number,
index_10?: number,
- peerId?: number,
+ peerId?: PeerId,
topMessage?: any,
- migratedTo?: number
+ migratedTo?: PeerId
};
export type dialogFolder = {
@@ -1271,7 +1285,7 @@ export namespace Dialog {
unread_muted_messages_count: number,
unread_unmuted_messages_count: number,
index?: number,
- peerId?: number,
+ peerId?: PeerId,
folder_id?: number
};
}
@@ -1284,7 +1298,7 @@ export type Photo = Photo.photoEmpty | Photo.photo;
export namespace Photo {
export type photoEmpty = {
_: 'photoEmpty',
- id: string
+ id: string | number
};
export type photo = {
@@ -1293,8 +1307,8 @@ export namespace Photo {
pFlags?: Partial<{
has_stickers?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[],
date: number,
sizes: Array,
@@ -1367,7 +1381,7 @@ export namespace GeoPoint {
flags?: number,
long: number,
lat: number,
- access_hash: string,
+ access_hash: string | number,
accuracy_radius?: number
};
}
@@ -1417,7 +1431,7 @@ export type AuthExportedAuthorization = AuthExportedAuthorization.authExportedAu
export namespace AuthExportedAuthorization {
export type authExportedAuthorization = {
_: 'auth.exportedAuthorization',
- id: number,
+ id: string | number,
bytes: Uint8Array
};
}
@@ -1509,7 +1523,7 @@ export type WallPaper = WallPaper.wallPaper | WallPaper.wallPaperNoFile;
export namespace WallPaper {
export type wallPaper = {
_: 'wallPaper',
- id: string,
+ id: string | number,
flags?: number,
pFlags?: Partial<{
creator?: true,
@@ -1517,7 +1531,7 @@ export namespace WallPaper {
pattern?: true,
dark?: true,
}>,
- access_hash: string,
+ access_hash: string | number,
slug: string,
document: Document,
settings?: WallPaperSettings
@@ -1525,7 +1539,7 @@ export namespace WallPaper {
export type wallPaperNoFile = {
_: 'wallPaperNoFile',
- id: string,
+ id: string | number,
flags?: number,
pFlags?: Partial<{
default?: true,
@@ -1601,6 +1615,7 @@ export namespace UserFull {
common_chats_count: number,
folder_id?: number,
ttl_period?: number,
+ theme_emoticon?: string,
rAbout?: string
};
}
@@ -1613,7 +1628,7 @@ export type Contact = Contact.contact;
export namespace Contact {
export type contact = {
_: 'contact',
- user_id: number,
+ user_id: string | number,
mutual: boolean
};
}
@@ -1626,8 +1641,8 @@ export type ImportedContact = ImportedContact.importedContact;
export namespace ImportedContact {
export type importedContact = {
_: 'importedContact',
- user_id: number,
- client_id: string
+ user_id: string | number,
+ client_id: string | number
};
}
@@ -1639,7 +1654,7 @@ export type ContactStatus = ContactStatus.contactStatus;
export namespace ContactStatus {
export type contactStatus = {
_: 'contactStatus',
- user_id: number,
+ user_id: string | number,
status: UserStatus
};
}
@@ -1672,7 +1687,7 @@ export namespace ContactsImportedContacts {
_: 'contacts.importedContacts',
imported: Array,
popular_invites: Array,
- retry_contacts: Array,
+ retry_contacts: Array,
users: Array
};
}
@@ -1916,7 +1931,7 @@ export namespace Update {
export type updateMessageID = {
_: 'updateMessageID',
id: number,
- random_id: string
+ random_id: string | number
};
export type updateDeleteMessages = {
@@ -1928,13 +1943,13 @@ export namespace Update {
export type updateUserTyping = {
_: 'updateUserTyping',
- user_id: number,
+ user_id: string | number,
action: SendMessageAction
};
export type updateChatUserTyping = {
_: 'updateChatUserTyping',
- chat_id: number,
+ chat_id: string | number,
from_id: Peer,
action: SendMessageAction
};
@@ -1946,13 +1961,13 @@ export namespace Update {
export type updateUserStatus = {
_: 'updateUserStatus',
- user_id: number,
+ user_id: string | number,
status: UserStatus
};
export type updateUserName = {
_: 'updateUserName',
- user_id: number,
+ user_id: string | number,
first_name: string,
last_name: string,
username: string
@@ -1960,7 +1975,7 @@ export namespace Update {
export type updateUserPhoto = {
_: 'updateUserPhoto',
- user_id: number,
+ user_id: string | number,
date: number,
photo: UserProfilePhoto,
previous: boolean
@@ -1992,17 +2007,17 @@ export namespace Update {
export type updateChatParticipantAdd = {
_: 'updateChatParticipantAdd',
- chat_id: number,
- user_id: number,
- inviter_id: number,
+ chat_id: string | number,
+ user_id: string | number,
+ inviter_id: string | number,
date: number,
version: number
};
export type updateChatParticipantDelete = {
_: 'updateChatParticipantDelete',
- chat_id: number,
- user_id: number,
+ chat_id: string | number,
+ user_id: string | number,
version: number
};
@@ -2038,7 +2053,7 @@ export namespace Update {
export type updateUserPhone = {
_: 'updateUserPhone',
- user_id: number,
+ user_id: string | number,
phone: string
};
@@ -2078,13 +2093,13 @@ export namespace Update {
export type updateChannelTooLong = {
_: 'updateChannelTooLong',
flags?: number,
- channel_id: number,
+ channel_id: string | number,
pts?: number
};
export type updateChannel = {
_: 'updateChannel',
- channel_id: number
+ channel_id: string | number
};
export type updateNewChannelMessage = {
@@ -2098,7 +2113,7 @@ export namespace Update {
_: 'updateReadChannelInbox',
flags?: number,
folder_id?: number,
- channel_id: number,
+ channel_id: string | number,
max_id: number,
still_unread_count: number,
pts: number
@@ -2106,7 +2121,7 @@ export namespace Update {
export type updateDeleteChannelMessages = {
_: 'updateDeleteChannelMessages',
- channel_id: number,
+ channel_id: string | number,
messages: Array,
pts: number,
pts_count: number
@@ -2114,15 +2129,15 @@ export namespace Update {
export type updateChannelMessageViews = {
_: 'updateChannelMessageViews',
- channel_id: number,
+ channel_id: string | number,
id: number,
views: number
};
export type updateChatParticipantAdmin = {
_: 'updateChatParticipantAdmin',
- chat_id: number,
- user_id: number,
+ chat_id: string | number,
+ user_id: string | number,
is_admin: boolean,
version: number
};
@@ -2138,7 +2153,7 @@ export namespace Update {
pFlags?: Partial<{
masks?: true,
}>,
- order: Array
+ order: Array
};
export type updateStickerSets = {
@@ -2152,8 +2167,8 @@ export namespace Update {
export type updateBotInlineQuery = {
_: 'updateBotInlineQuery',
flags?: number,
- query_id: string,
- user_id: number,
+ query_id: string | number,
+ user_id: string | number,
query: string,
geo?: GeoPoint,
peer_type?: InlineQueryPeerType,
@@ -2163,7 +2178,7 @@ export namespace Update {
export type updateBotInlineSend = {
_: 'updateBotInlineSend',
flags?: number,
- user_id: number,
+ user_id: string | number,
query: string,
geo?: GeoPoint,
id: string,
@@ -2180,11 +2195,11 @@ export namespace Update {
export type updateBotCallbackQuery = {
_: 'updateBotCallbackQuery',
flags?: number,
- query_id: string,
- user_id: number,
+ query_id: string | number,
+ user_id: string | number,
peer: Peer,
msg_id: number,
- chat_instance: string,
+ chat_instance: string | number,
data?: Uint8Array,
game_short_name?: string
};
@@ -2199,17 +2214,17 @@ export namespace Update {
export type updateInlineBotCallbackQuery = {
_: 'updateInlineBotCallbackQuery',
flags?: number,
- query_id: string,
- user_id: number,
+ query_id: string | number,
+ user_id: string | number,
msg_id: InputBotInlineMessageID,
- chat_instance: string,
+ chat_instance: string | number,
data?: Uint8Array,
game_short_name?: string
};
export type updateReadChannelOutbox = {
_: 'updateReadChannelOutbox',
- channel_id: number,
+ channel_id: string | number,
max_id: number
};
@@ -2239,7 +2254,7 @@ export namespace Update {
export type updateChannelWebPage = {
_: 'updateChannelWebPage',
- channel_id: number,
+ channel_id: string | number,
webpage: WebPage,
pts: number,
pts_count: number
@@ -2269,15 +2284,15 @@ export namespace Update {
export type updateBotWebhookJSONQuery = {
_: 'updateBotWebhookJSONQuery',
- query_id: string,
+ query_id: string | number,
data: DataJSON,
timeout: number
};
export type updateBotShippingQuery = {
_: 'updateBotShippingQuery',
- query_id: string,
- user_id: number,
+ query_id: string | number,
+ user_id: string | number,
payload: Uint8Array,
shipping_address: PostAddress
};
@@ -2285,13 +2300,13 @@ export namespace Update {
export type updateBotPrecheckoutQuery = {
_: 'updateBotPrecheckoutQuery',
flags?: number,
- query_id: string,
- user_id: number,
+ query_id: string | number,
+ user_id: string | number,
payload: Uint8Array,
info?: PaymentRequestedInfo,
shipping_option_id?: string,
currency: string,
- total_amount: string
+ total_amount: string | number
};
export type updatePhoneCall = {
@@ -2315,7 +2330,7 @@ export namespace Update {
export type updateChannelReadMessagesContents = {
_: 'updateChannelReadMessagesContents',
- channel_id: number,
+ channel_id: string | number,
messages: Array
};
@@ -2325,7 +2340,7 @@ export namespace Update {
export type updateChannelAvailableMessages = {
_: 'updateChannelAvailableMessages',
- channel_id: number,
+ channel_id: string | number,
available_min_id: number
};
@@ -2341,7 +2356,7 @@ export namespace Update {
export type updateMessagePoll = {
_: 'updateMessagePoll',
flags?: number,
- poll_id: string,
+ poll_id: string | number,
poll?: Poll,
results: PollResults
};
@@ -2399,8 +2414,8 @@ export namespace Update {
export type updateMessagePollVote = {
_: 'updateMessagePollVote',
- poll_id: string,
- user_id: number,
+ poll_id: string | number,
+ user_id: string | number,
options: Array,
qts: number
};
@@ -2423,13 +2438,13 @@ export namespace Update {
export type updatePhoneCallSignalingData = {
_: 'updatePhoneCallSignalingData',
- phone_call_id: string,
+ phone_call_id: string | number,
data: Uint8Array
};
export type updateChannelMessageForwards = {
_: 'updateChannelMessageForwards',
- channel_id: number,
+ channel_id: string | number,
id: number,
forwards: number
};
@@ -2437,16 +2452,16 @@ export namespace Update {
export type updateReadChannelDiscussionInbox = {
_: 'updateReadChannelDiscussionInbox',
flags?: number,
- channel_id: number,
+ channel_id: string | number,
top_msg_id: number,
read_max_id: number,
- broadcast_id?: number,
+ broadcast_id?: string | number,
broadcast_post?: number
};
export type updateReadChannelDiscussionOutbox = {
_: 'updateReadChannelDiscussionOutbox',
- channel_id: number,
+ channel_id: string | number,
top_msg_id: number,
read_max_id: number
};
@@ -2460,7 +2475,7 @@ export namespace Update {
export type updateChannelUserTyping = {
_: 'updateChannelUserTyping',
flags?: number,
- channel_id: number,
+ channel_id: string | number,
top_msg_id?: number,
from_id: Peer,
action: SendMessageAction
@@ -2484,7 +2499,7 @@ export namespace Update {
pFlags?: Partial<{
pinned?: true,
}>,
- channel_id: number,
+ channel_id: string | number,
messages: Array,
pts: number,
pts_count: number
@@ -2492,7 +2507,7 @@ export namespace Update {
export type updateChat = {
_: 'updateChat',
- chat_id: number
+ chat_id: string | number
};
export type updateGroupCallParticipants = {
@@ -2504,7 +2519,7 @@ export namespace Update {
export type updateGroupCall = {
_: 'updateGroupCall',
- chat_id: number,
+ chat_id: string | number,
call: GroupCall
};
@@ -2518,10 +2533,10 @@ export namespace Update {
export type updateChatParticipant = {
_: 'updateChatParticipant',
flags?: number,
- chat_id: number,
+ chat_id: string | number,
date: number,
- actor_id: number,
- user_id: number,
+ actor_id: string | number,
+ user_id: string | number,
prev_participant?: ChatParticipant,
new_participant?: ChatParticipant,
invite?: ExportedChatInvite,
@@ -2531,10 +2546,10 @@ export namespace Update {
export type updateChannelParticipant = {
_: 'updateChannelParticipant',
flags?: number,
- channel_id: number,
+ channel_id: string | number,
date: number,
- actor_id: number,
- user_id: number,
+ actor_id: string | number,
+ user_id: string | number,
prev_participant?: ChannelParticipant,
new_participant?: ChannelParticipant,
invite?: ExportedChatInvite,
@@ -2543,7 +2558,7 @@ export namespace Update {
export type updateBotStopped = {
_: 'updateBotStopped',
- user_id: number,
+ user_id: string | number,
date: number,
stopped: boolean,
qts: number
@@ -2561,7 +2576,7 @@ export namespace Update {
export type updateBotCommands = {
_: 'updateBotCommands',
peer: Peer,
- bot_id: number,
+ bot_id: string | number,
commands: Array
};
@@ -2573,12 +2588,12 @@ export namespace Update {
export type updateDeleteDiscussionMessages = {
_: 'updateDeleteDiscussionMessages',
messages?: number[],
- channel_id?: number
+ channel_id?: ChatId
};
export type updateChannelReload = {
_: 'updateChannelReload',
- channel_id?: number
+ channel_id?: ChatId
};
}
@@ -2656,13 +2671,13 @@ export namespace Updates {
silent?: true,
}>,
id: number,
- user_id: number,
+ user_id: string | number,
message: string,
pts: number,
pts_count: number,
date: number,
fwd_from?: MessageFwdHeader,
- via_bot_id?: number,
+ via_bot_id?: string | number,
reply_to?: MessageReplyHeader,
entities?: Array,
ttl_period?: number
@@ -2678,14 +2693,14 @@ export namespace Updates {
silent?: true,
}>,
id: number,
- from_id: number,
- chat_id: number,
+ from_id: string | number,
+ chat_id: string | number,
message: string,
pts: number,
pts_count: number,
date: number,
fwd_from?: MessageFwdHeader,
- via_bot_id?: number,
+ via_bot_id?: string | number,
reply_to?: MessageReplyHeader,
entities?: Array,
ttl_period?: number
@@ -2942,10 +2957,10 @@ export namespace EncryptedChat {
export type encryptedChatWaiting = {
_: 'encryptedChatWaiting',
id: number,
- access_hash: string,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number
+ admin_id: string | number,
+ participant_id: string | number
};
export type encryptedChatRequested = {
@@ -2953,22 +2968,22 @@ export namespace EncryptedChat {
flags?: number,
folder_id?: number,
id: number,
- access_hash: string,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number,
+ admin_id: string | number,
+ participant_id: string | number,
g_a: Uint8Array
};
export type encryptedChat = {
_: 'encryptedChat',
id: number,
- access_hash: string,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number,
+ admin_id: string | number,
+ participant_id: string | number,
g_a_or_b: Uint8Array,
- key_fingerprint: string
+ key_fingerprint: string | number
};
export type encryptedChatDiscarded = {
@@ -2990,7 +3005,7 @@ export namespace InputEncryptedChat {
export type inputEncryptedChat = {
_: 'inputEncryptedChat',
chat_id: number,
- access_hash: string
+ access_hash: string | number
};
}
@@ -3006,8 +3021,8 @@ export namespace EncryptedFile {
export type encryptedFile = {
_: 'encryptedFile',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
size: number,
dc_id: number,
key_fingerprint: number
@@ -3026,7 +3041,7 @@ export namespace InputEncryptedFile {
export type inputEncryptedFileUploaded = {
_: 'inputEncryptedFileUploaded',
- id: string,
+ id: string | number,
parts: number,
md5_checksum: string,
key_fingerprint: number
@@ -3034,13 +3049,13 @@ export namespace InputEncryptedFile {
export type inputEncryptedFile = {
_: 'inputEncryptedFile',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputEncryptedFileBigUploaded = {
_: 'inputEncryptedFileBigUploaded',
- id: string,
+ id: string | number,
parts: number,
key_fingerprint: number
};
@@ -3054,7 +3069,7 @@ export type EncryptedMessage = EncryptedMessage.encryptedMessage | EncryptedMess
export namespace EncryptedMessage {
export type encryptedMessage = {
_: 'encryptedMessage',
- random_id: string,
+ random_id: string | number,
chat_id: number,
date: number,
bytes: Uint8Array,
@@ -3063,7 +3078,7 @@ export namespace EncryptedMessage {
export type encryptedMessageService = {
_: 'encryptedMessageService',
- random_id: string,
+ random_id: string | number,
chat_id: number,
date: number,
bytes: Uint8Array
@@ -3120,8 +3135,8 @@ export namespace InputDocument {
export type inputDocument = {
_: 'inputDocument',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[]
};
}
@@ -3134,14 +3149,14 @@ export type Document = Document.documentEmpty | Document.document;
export namespace Document {
export type documentEmpty = {
_: 'documentEmpty',
- id: string
+ id: string | number
};
export type document = {
_: 'document',
flags?: number,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
file_reference: Uint8Array | number[],
date: number,
mime_type: string,
@@ -3212,7 +3227,7 @@ export namespace NotifyPeer {
/**
* @link https://core.telegram.org/type/SendMessageAction
*/
-export type SendMessageAction = SendMessageAction.sendMessageTypingAction | SendMessageAction.sendMessageCancelAction | SendMessageAction.sendMessageRecordVideoAction | SendMessageAction.sendMessageUploadVideoAction | SendMessageAction.sendMessageRecordAudioAction | SendMessageAction.sendMessageUploadAudioAction | SendMessageAction.sendMessageUploadPhotoAction | SendMessageAction.sendMessageUploadDocumentAction | SendMessageAction.sendMessageGeoLocationAction | SendMessageAction.sendMessageChooseContactAction | SendMessageAction.sendMessageGamePlayAction | SendMessageAction.sendMessageRecordRoundAction | SendMessageAction.sendMessageUploadRoundAction | SendMessageAction.speakingInGroupCallAction | SendMessageAction.sendMessageHistoryImportAction;
+export type SendMessageAction = SendMessageAction.sendMessageTypingAction | SendMessageAction.sendMessageCancelAction | SendMessageAction.sendMessageRecordVideoAction | SendMessageAction.sendMessageUploadVideoAction | SendMessageAction.sendMessageRecordAudioAction | SendMessageAction.sendMessageUploadAudioAction | SendMessageAction.sendMessageUploadPhotoAction | SendMessageAction.sendMessageUploadDocumentAction | SendMessageAction.sendMessageGeoLocationAction | SendMessageAction.sendMessageChooseContactAction | SendMessageAction.sendMessageGamePlayAction | SendMessageAction.sendMessageRecordRoundAction | SendMessageAction.sendMessageUploadRoundAction | SendMessageAction.speakingInGroupCallAction | SendMessageAction.sendMessageHistoryImportAction | SendMessageAction.sendMessageChooseStickerAction | SendMessageAction.sendMessageEmojiInteraction | SendMessageAction.sendMessageEmojiInteractionSeen;
export namespace SendMessageAction {
export type sendMessageTypingAction = {
@@ -3280,6 +3295,21 @@ export namespace SendMessageAction {
_: 'sendMessageHistoryImportAction',
progress: number
};
+
+ export type sendMessageChooseStickerAction = {
+ _: 'sendMessageChooseStickerAction'
+ };
+
+ export type sendMessageEmojiInteraction = {
+ _: 'sendMessageEmojiInteraction',
+ emoticon: string,
+ interaction: DataJSON
+ };
+
+ export type sendMessageEmojiInteractionSeen = {
+ _: 'sendMessageEmojiInteractionSeen',
+ emoticon: string
+ };
}
/**
@@ -3409,12 +3439,12 @@ export namespace InputPrivacyRule {
export type inputPrivacyValueAllowChatParticipants = {
_: 'inputPrivacyValueAllowChatParticipants',
- chats: Array
+ chats: Array
};
export type inputPrivacyValueDisallowChatParticipants = {
_: 'inputPrivacyValueDisallowChatParticipants',
- chats: Array
+ chats: Array
};
}
@@ -3434,7 +3464,7 @@ export namespace PrivacyRule {
export type privacyValueAllowUsers = {
_: 'privacyValueAllowUsers',
- users: Array
+ users: Array
};
export type privacyValueDisallowContacts = {
@@ -3447,17 +3477,17 @@ export namespace PrivacyRule {
export type privacyValueDisallowUsers = {
_: 'privacyValueDisallowUsers',
- users: Array
+ users: Array
};
export type privacyValueAllowChatParticipants = {
_: 'privacyValueAllowChatParticipants',
- chats: Array
+ chats: Array
};
export type privacyValueDisallowChatParticipants = {
_: 'privacyValueDisallowChatParticipants',
- chats: Array
+ chats: Array
};
}
@@ -3560,7 +3590,7 @@ export namespace MessagesStickers {
export type messagesStickers = {
_: 'messages.stickers',
- hash: number,
+ hash: string | number,
stickers: Array
};
}
@@ -3574,7 +3604,7 @@ export namespace StickerPack {
export type stickerPack = {
_: 'stickerPack',
emoticon: string,
- documents: Array
+ documents: Array
};
}
@@ -3590,7 +3620,7 @@ export namespace MessagesAllStickers {
export type messagesAllStickers = {
_: 'messages.allStickers',
- hash: number,
+ hash: string | number,
sets: Array
};
}
@@ -3616,19 +3646,19 @@ export type WebPage = WebPage.webPageEmpty | WebPage.webPagePending | WebPage.we
export namespace WebPage {
export type webPageEmpty = {
_: 'webPageEmpty',
- id: string
+ id: string | number
};
export type webPagePending = {
_: 'webPagePending',
- id: string,
+ id: string | number,
date: number
};
export type webPage = {
_: 'webPage',
flags?: number,
- id: string,
+ id: string | number,
url: string,
display_url: string,
hash: number,
@@ -3671,7 +3701,7 @@ export namespace Authorization {
official_app?: true,
password_pending?: true,
}>,
- hash: string,
+ hash: string | number,
device_model: string,
platform: string,
system_version: string,
@@ -3714,7 +3744,7 @@ export namespace AccountPassword {
}>,
current_algo?: PasswordKdfAlgo,
srp_B?: Uint8Array,
- srp_id?: string,
+ srp_id?: string | number,
hint?: string,
email_unconfirmed_pattern?: string,
new_algo: PasswordKdfAlgo,
@@ -3794,7 +3824,7 @@ export namespace ExportedChatInvite {
permanent?: true,
}>,
link: string,
- admin_id: number,
+ admin_id: string | number,
date: number,
start_date?: number,
expire_date?: number,
@@ -3848,8 +3878,8 @@ export namespace InputStickerSet {
export type inputStickerSetID = {
_: 'inputStickerSetID',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputStickerSetShortName = {
@@ -3883,8 +3913,8 @@ export namespace StickerSet {
animated?: true,
}>,
installed_date?: number,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
title: string,
short_name: string,
thumbs?: Array,
@@ -3931,7 +3961,7 @@ export type BotInfo = BotInfo.botInfo;
export namespace BotInfo {
export type botInfo = {
_: 'botInfo',
- user_id: number,
+ user_id: string | number,
description: string,
commands: Array
};
@@ -4061,7 +4091,7 @@ export namespace ReplyMarkup {
}>,
placeholder?: string,
mid?: number,
- fromId?: number
+ fromId?: PeerId
};
export type replyKeyboardMarkup = {
@@ -4076,7 +4106,7 @@ export namespace ReplyMarkup {
rows: Array,
placeholder?: string,
mid?: number,
- fromId?: number
+ fromId?: PeerId
};
export type replyInlineMarkup = {
@@ -4164,7 +4194,7 @@ export namespace MessageEntity {
_: 'messageEntityMentionName',
offset: number,
length: number,
- user_id: number
+ user_id: string | number
};
export type inputMessageEntityMentionName = {
@@ -4248,15 +4278,15 @@ export namespace InputChannel {
export type inputChannel = {
_: 'inputChannel',
- channel_id: number,
- access_hash: string
+ channel_id: string | number,
+ access_hash: string | number
};
export type inputChannelFromMessage = {
_: 'inputChannelFromMessage',
peer: InputPeer,
msg_id: number,
- channel_id: number
+ channel_id: string | number
};
}
@@ -4359,21 +4389,21 @@ export type ChannelParticipant = ChannelParticipant.channelParticipant | Channel
export namespace ChannelParticipant {
export type channelParticipant = {
_: 'channelParticipant',
- user_id: number,
+ user_id: string | number,
date: number
};
export type channelParticipantSelf = {
_: 'channelParticipantSelf',
- user_id: number,
- inviter_id: number,
+ user_id: string | number,
+ inviter_id: string | number,
date: number
};
export type channelParticipantCreator = {
_: 'channelParticipantCreator',
flags?: number,
- user_id: number,
+ user_id: string | number,
admin_rights: ChatAdminRights,
rank?: string
};
@@ -4385,9 +4415,9 @@ export namespace ChannelParticipant {
can_edit?: true,
self?: true,
}>,
- user_id: number,
- inviter_id?: number,
- promoted_by: number,
+ user_id: string | number,
+ inviter_id?: string | number,
+ promoted_by: string | number,
date: number,
admin_rights: ChatAdminRights,
rank?: string
@@ -4400,7 +4430,7 @@ export namespace ChannelParticipant {
left?: true,
}>,
peer: Peer,
- kicked_by: number,
+ kicked_by: string | number,
date: number,
banned_rights: ChatBannedRights
};
@@ -4521,7 +4551,7 @@ export namespace MessagesSavedGifs {
export type messagesSavedGifs = {
_: 'messages.savedGifs',
- hash: number,
+ hash: string | number,
gifs: Array
};
}
@@ -4717,7 +4747,7 @@ export namespace BotInlineMessage {
description: string,
photo?: WebDocument,
currency: string,
- total_amount: string,
+ total_amount: string | number,
reply_markup?: ReplyMarkup
};
}
@@ -4766,7 +4796,7 @@ export namespace MessagesBotResults {
pFlags?: Partial<{
gallery?: true,
}>,
- query_id: string,
+ query_id: string | number,
next_offset?: string,
switch_pm?: InlineBotSwitchPM,
results: Array,
@@ -4895,14 +4925,22 @@ export namespace MessagesMessageEditData {
/**
* @link https://core.telegram.org/type/InputBotInlineMessageID
*/
-export type InputBotInlineMessageID = InputBotInlineMessageID.inputBotInlineMessageID;
+export type InputBotInlineMessageID = InputBotInlineMessageID.inputBotInlineMessageID | InputBotInlineMessageID.inputBotInlineMessageID64;
export namespace InputBotInlineMessageID {
export type inputBotInlineMessageID = {
_: 'inputBotInlineMessageID',
dc_id: number,
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
+ };
+
+ export type inputBotInlineMessageID64 = {
+ _: 'inputBotInlineMessageID64',
+ dc_id: number,
+ owner_id: string | number,
+ id: number,
+ access_hash: string | number
};
}
@@ -5063,10 +5101,10 @@ export namespace MessagesFeaturedStickers {
export type messagesFeaturedStickers = {
_: 'messages.featuredStickers',
- hash: number,
+ hash: string | number,
count: number,
sets: Array,
- unread: Array
+ unread: Array
};
}
@@ -5082,7 +5120,7 @@ export namespace MessagesRecentStickers {
export type messagesRecentStickers = {
_: 'messages.recentStickers',
- hash: number,
+ hash: string | number,
packs: Array,
stickers: Array,
dates: Array
@@ -5178,8 +5216,8 @@ export namespace Game {
export type game = {
_: 'game',
flags?: number,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
short_name: string,
title: string,
description: string,
@@ -5196,8 +5234,8 @@ export type InputGame = InputGame.inputGameID | InputGame.inputGameShortName;
export namespace InputGame {
export type inputGameID = {
_: 'inputGameID',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputGameShortName = {
@@ -5216,7 +5254,7 @@ export namespace HighScore {
export type highScore = {
_: 'highScore',
pos: number,
- user_id: number,
+ user_id: string | number,
score: number
};
}
@@ -5278,7 +5316,7 @@ export namespace RichText {
_: 'textUrl',
text: RichText,
url: string,
- webpage_id: string
+ webpage_id: string | number
};
export type textEmail = {
@@ -5315,7 +5353,7 @@ export namespace RichText {
export type textImage = {
_: 'textImage',
- document_id: string,
+ document_id: string | number,
w: number,
h: number
};
@@ -5408,10 +5446,10 @@ export namespace PageBlock {
export type pageBlockPhoto = {
_: 'pageBlockPhoto',
flags?: number,
- photo_id: string,
+ photo_id: string | number,
caption: PageCaption,
url?: string,
- webpage_id?: string
+ webpage_id?: string | number
};
export type pageBlockVideo = {
@@ -5421,7 +5459,7 @@ export namespace PageBlock {
autoplay?: true,
loop?: true,
}>,
- video_id: string,
+ video_id: string | number,
caption: PageCaption
};
@@ -5439,7 +5477,7 @@ export namespace PageBlock {
}>,
url?: string,
html?: string,
- poster_photo_id?: string,
+ poster_photo_id?: string | number,
w?: number,
h?: number,
caption: PageCaption
@@ -5448,8 +5486,8 @@ export namespace PageBlock {
export type pageBlockEmbedPost = {
_: 'pageBlockEmbedPost',
url: string,
- webpage_id: string,
- author_photo_id: string,
+ webpage_id: string | number,
+ author_photo_id: string | number,
author: string,
date: number,
blocks: Array,
@@ -5475,7 +5513,7 @@ export namespace PageBlock {
export type pageBlockAudio = {
_: 'pageBlockAudio',
- audio_id: string,
+ audio_id: string | number,
caption: PageCaption
};
@@ -5570,7 +5608,7 @@ export namespace LabeledPrice {
export type labeledPrice = {
_: 'labeledPrice',
label: string,
- amount: string
+ amount: string | number
};
}
@@ -5595,8 +5633,8 @@ export namespace Invoice {
}>,
currency: string,
prices: Array,
- max_tip_amount?: string,
- suggested_tip_amounts?: Array
+ max_tip_amount?: string | number,
+ suggested_tip_amounts?: Array
};
}
@@ -5668,7 +5706,7 @@ export namespace WebDocument {
export type webDocument = {
_: 'webDocument',
url: string,
- access_hash: string,
+ access_hash: string | number,
size: number,
mime_type: string,
attributes: Array
@@ -5707,13 +5745,13 @@ export namespace InputWebFileLocation {
export type inputWebFileLocation = {
_: 'inputWebFileLocation',
url: string,
- access_hash: string
+ access_hash: string | number
};
export type inputWebFileGeoPointLocation = {
_: 'inputWebFileGeoPointLocation',
geo_point: InputGeoPoint,
- access_hash: string,
+ access_hash: string | number,
w: number,
h: number,
zoom: number,
@@ -5750,10 +5788,10 @@ export namespace PaymentsPaymentForm {
can_save_credentials?: true,
password_missing?: true,
}>,
- form_id: string,
- bot_id: number,
+ form_id: string | number,
+ bot_id: string | number,
invoice: Invoice,
- provider_id: number,
+ provider_id: string | number,
url: string,
native_provider?: string,
native_params?: DataJSON,
@@ -5804,17 +5842,17 @@ export namespace PaymentsPaymentReceipt {
_: 'payments.paymentReceipt',
flags?: number,
date: number,
- bot_id: number,
- provider_id: number,
+ bot_id: string | number,
+ provider_id: string | number,
title: string,
description: string,
photo?: WebDocument,
invoice: Invoice,
info?: PaymentRequestedInfo,
shipping?: ShippingOption,
- tip_amount?: string,
+ tip_amount?: string | number,
currency: string,
- total_amount: string,
+ total_amount: string | number,
credentials_title: string,
users: Array
};
@@ -5918,8 +5956,8 @@ export type InputPhoneCall = InputPhoneCall.inputPhoneCall;
export namespace InputPhoneCall {
export type inputPhoneCall = {
_: 'inputPhoneCall',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
}
@@ -5931,7 +5969,7 @@ export type PhoneCall = PhoneCall.phoneCallEmpty | PhoneCall.phoneCallWaiting |
export namespace PhoneCall {
export type phoneCallEmpty = {
_: 'phoneCallEmpty',
- id: string
+ id: string | number
};
export type phoneCallWaiting = {
@@ -5940,11 +5978,11 @@ export namespace PhoneCall {
pFlags?: Partial<{
video?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number,
+ admin_id: string | number,
+ participant_id: string | number,
protocol: PhoneCallProtocol,
receive_date?: number
};
@@ -5955,11 +5993,11 @@ export namespace PhoneCall {
pFlags?: Partial<{
video?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number,
+ admin_id: string | number,
+ participant_id: string | number,
g_a_hash: Uint8Array,
protocol: PhoneCallProtocol
};
@@ -5970,11 +6008,11 @@ export namespace PhoneCall {
pFlags?: Partial<{
video?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number,
+ admin_id: string | number,
+ participant_id: string | number,
g_b: Uint8Array,
protocol: PhoneCallProtocol
};
@@ -5986,13 +6024,13 @@ export namespace PhoneCall {
p2p_allowed?: true,
video?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
date: number,
- admin_id: number,
- participant_id: number,
+ admin_id: string | number,
+ participant_id: string | number,
g_a_or_b: Uint8Array,
- key_fingerprint: string,
+ key_fingerprint: string | number,
protocol: PhoneCallProtocol,
connections: Array,
start_date: number
@@ -6006,7 +6044,7 @@ export namespace PhoneCall {
need_debug?: true,
video?: true,
}>,
- id: string,
+ id: string | number,
reason?: PhoneCallDiscardReason,
duration?: number
};
@@ -6020,7 +6058,7 @@ export type PhoneConnection = PhoneConnection.phoneConnection | PhoneConnection.
export namespace PhoneConnection {
export type phoneConnection = {
_: 'phoneConnection',
- id: string,
+ id: string | number,
ip: string,
ipv6: string,
port: number,
@@ -6034,7 +6072,7 @@ export namespace PhoneConnection {
turn?: true,
stun?: true,
}>,
- id: string,
+ id: string | number,
ip: string,
ipv6: string,
port: number,
@@ -6193,7 +6231,7 @@ export namespace LangPackLanguage {
/**
* @link https://core.telegram.org/type/ChannelAdminLogEventAction
*/
-export type ChannelAdminLogEventAction = ChannelAdminLogEventAction.channelAdminLogEventActionChangeTitle | ChannelAdminLogEventAction.channelAdminLogEventActionChangeAbout | ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsername | ChannelAdminLogEventAction.channelAdminLogEventActionChangePhoto | ChannelAdminLogEventAction.channelAdminLogEventActionToggleInvites | ChannelAdminLogEventAction.channelAdminLogEventActionToggleSignatures | ChannelAdminLogEventAction.channelAdminLogEventActionUpdatePinned | ChannelAdminLogEventAction.channelAdminLogEventActionEditMessage | ChannelAdminLogEventAction.channelAdminLogEventActionDeleteMessage | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoin | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantLeave | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantInvite | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleBan | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleAdmin | ChannelAdminLogEventAction.channelAdminLogEventActionChangeStickerSet | ChannelAdminLogEventAction.channelAdminLogEventActionTogglePreHistoryHidden | ChannelAdminLogEventAction.channelAdminLogEventActionDefaultBannedRights | ChannelAdminLogEventAction.channelAdminLogEventActionStopPoll | ChannelAdminLogEventAction.channelAdminLogEventActionChangeLinkedChat | ChannelAdminLogEventAction.channelAdminLogEventActionChangeLocation | ChannelAdminLogEventAction.channelAdminLogEventActionToggleSlowMode | ChannelAdminLogEventAction.channelAdminLogEventActionStartGroupCall | ChannelAdminLogEventAction.channelAdminLogEventActionDiscardGroupCall | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantMute | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantUnmute | ChannelAdminLogEventAction.channelAdminLogEventActionToggleGroupCallSetting | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByInvite | ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteDelete | ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteRevoke | ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteEdit | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantVolume | ChannelAdminLogEventAction.channelAdminLogEventActionChangeHistoryTTL;
+export type ChannelAdminLogEventAction = ChannelAdminLogEventAction.channelAdminLogEventActionChangeTitle | ChannelAdminLogEventAction.channelAdminLogEventActionChangeAbout | ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsername | ChannelAdminLogEventAction.channelAdminLogEventActionChangePhoto | ChannelAdminLogEventAction.channelAdminLogEventActionToggleInvites | ChannelAdminLogEventAction.channelAdminLogEventActionToggleSignatures | ChannelAdminLogEventAction.channelAdminLogEventActionUpdatePinned | ChannelAdminLogEventAction.channelAdminLogEventActionEditMessage | ChannelAdminLogEventAction.channelAdminLogEventActionDeleteMessage | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoin | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantLeave | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantInvite | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleBan | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleAdmin | ChannelAdminLogEventAction.channelAdminLogEventActionChangeStickerSet | ChannelAdminLogEventAction.channelAdminLogEventActionTogglePreHistoryHidden | ChannelAdminLogEventAction.channelAdminLogEventActionDefaultBannedRights | ChannelAdminLogEventAction.channelAdminLogEventActionStopPoll | ChannelAdminLogEventAction.channelAdminLogEventActionChangeLinkedChat | ChannelAdminLogEventAction.channelAdminLogEventActionChangeLocation | ChannelAdminLogEventAction.channelAdminLogEventActionToggleSlowMode | ChannelAdminLogEventAction.channelAdminLogEventActionStartGroupCall | ChannelAdminLogEventAction.channelAdminLogEventActionDiscardGroupCall | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantMute | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantUnmute | ChannelAdminLogEventAction.channelAdminLogEventActionToggleGroupCallSetting | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByInvite | ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteDelete | ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteRevoke | ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteEdit | ChannelAdminLogEventAction.channelAdminLogEventActionParticipantVolume | ChannelAdminLogEventAction.channelAdminLogEventActionChangeHistoryTTL | ChannelAdminLogEventAction.channelAdminLogEventActionChangeTheme;
export namespace ChannelAdminLogEventAction {
export type channelAdminLogEventActionChangeTitle = {
@@ -6295,8 +6333,8 @@ export namespace ChannelAdminLogEventAction {
export type channelAdminLogEventActionChangeLinkedChat = {
_: 'channelAdminLogEventActionChangeLinkedChat',
- prev_value: number,
- new_value: number
+ prev_value: string | number,
+ new_value: string | number
};
export type channelAdminLogEventActionChangeLocation = {
@@ -6367,6 +6405,12 @@ export namespace ChannelAdminLogEventAction {
prev_value: number,
new_value: number
};
+
+ export type channelAdminLogEventActionChangeTheme = {
+ _: 'channelAdminLogEventActionChangeTheme',
+ prev_value: string,
+ new_value: string
+ };
}
/**
@@ -6377,9 +6421,9 @@ export type ChannelAdminLogEvent = ChannelAdminLogEvent.channelAdminLogEvent;
export namespace ChannelAdminLogEvent {
export type channelAdminLogEvent = {
_: 'channelAdminLogEvent',
- id: string,
+ id: string | number,
date: number,
- user_id: number,
+ user_id: string | number,
action: ChannelAdminLogEventAction
};
}
@@ -6436,7 +6480,7 @@ export type PopularContact = PopularContact.popularContact;
export namespace PopularContact {
export type popularContact = {
_: 'popularContact',
- client_id: string,
+ client_id: string | number,
importers: number
};
}
@@ -6453,7 +6497,7 @@ export namespace MessagesFavedStickers {
export type messagesFavedStickers = {
_: 'messages.favedStickers',
- hash: number,
+ hash: string | number,
packs: Array,
stickers: Array
};
@@ -6473,13 +6517,13 @@ export namespace RecentMeUrl {
export type recentMeUrlUser = {
_: 'recentMeUrlUser',
url: string,
- user_id: number
+ user_id: string | number
};
export type recentMeUrlChat = {
_: 'recentMeUrlChat',
url: string,
- chat_id: number
+ chat_id: string | number
};
export type recentMeUrlChatInvite = {
@@ -6519,7 +6563,7 @@ export namespace InputSingleMedia {
_: 'inputSingleMedia',
flags?: number,
media: InputMedia,
- random_id: string,
+ random_id: string | number,
message: string,
entities?: Array
};
@@ -6533,8 +6577,8 @@ export type WebAuthorization = WebAuthorization.webAuthorization;
export namespace WebAuthorization {
export type webAuthorization = {
_: 'webAuthorization',
- hash: string,
- bot_id: number,
+ hash: string | number,
+ bot_id: string | number,
domain: string,
browser: string,
platform: string,
@@ -6581,7 +6625,7 @@ export namespace InputMessage {
export type inputMessageCallbackQuery = {
_: 'inputMessageCallbackQuery',
id: number,
- query_id: string
+ query_id: string | number
};
}
@@ -6631,7 +6675,7 @@ export namespace MessagesFoundStickerSets {
export type messagesFoundStickerSets = {
_: 'messages.foundStickerSets',
- hash: number,
+ hash: string | number,
sets: Array
};
}
@@ -6689,7 +6733,7 @@ export type InputSecureFile = InputSecureFile.inputSecureFileUploaded | InputSec
export namespace InputSecureFile {
export type inputSecureFileUploaded = {
_: 'inputSecureFileUploaded',
- id: string,
+ id: string | number,
parts: number,
md5_checksum: string,
file_hash: Uint8Array,
@@ -6698,8 +6742,8 @@ export namespace InputSecureFile {
export type inputSecureFile = {
_: 'inputSecureFile',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
}
@@ -6715,8 +6759,8 @@ export namespace SecureFile {
export type secureFile = {
_: 'secureFile',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
size: number,
dc_id: number,
date: number,
@@ -7028,7 +7072,7 @@ export type AccountTakeout = AccountTakeout.accountTakeout;
export namespace AccountTakeout {
export type accountTakeout = {
_: 'account.takeout',
- id: string
+ id: string | number
};
}
@@ -7082,7 +7126,7 @@ export namespace SecureSecretSettings {
_: 'secureSecretSettings',
secure_algo: SecurePasswordKdfAlgo,
secure_secret: Uint8Array,
- secure_secret_id: string
+ secure_secret_id: string | number
};
}
@@ -7098,7 +7142,7 @@ export namespace InputCheckPasswordSRP {
export type inputCheckPasswordSRP = {
_: 'inputCheckPasswordSRP',
- srp_id: string,
+ srp_id: string | number,
A: Uint8Array,
M1: Uint8Array
};
@@ -7154,7 +7198,7 @@ export namespace InputAppEvent {
_: 'inputAppEvent',
time: number,
type: string,
- peer: string,
+ peer: string | number,
data: JSONValue
};
}
@@ -7301,10 +7345,10 @@ export namespace PageRelatedArticle {
_: 'pageRelatedArticle',
flags?: number,
url: string,
- webpage_id: string,
+ webpage_id: string | number,
title?: string,
description?: string,
- photo_id?: string,
+ photo_id?: string | number,
author?: string,
published_date?: number
};
@@ -7384,7 +7428,7 @@ export type Poll = Poll.poll;
export namespace Poll {
export type poll = {
_: 'poll',
- id: string,
+ id: string | number,
flags?: number,
pFlags?: Partial<{
closed?: true,
@@ -7395,7 +7439,10 @@ export namespace Poll {
question: string,
answers: Array,
close_period?: number,
- close_date?: number
+ close_date?: number,
+ rQuestion?: string,
+ rReply?: string,
+ chosenIndexes?: number[]
};
}
@@ -7431,7 +7478,7 @@ export namespace PollResults {
}>,
results?: Array,
total_voters?: number,
- recent_voters?: Array,
+ recent_voters?: Array,
solution?: string,
solution_entities?: Array
};
@@ -7521,8 +7568,8 @@ export type InputWallPaper = InputWallPaper.inputWallPaper | InputWallPaper.inpu
export namespace InputWallPaper {
export type inputWallPaper = {
_: 'inputWallPaper',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputWallPaperSlug = {
@@ -7532,7 +7579,7 @@ export namespace InputWallPaper {
export type inputWallPaperNoFile = {
_: 'inputWallPaperNoFile',
- id: string
+ id: string | number
};
}
@@ -7548,7 +7595,7 @@ export namespace AccountWallPapers {
export type accountWallPapers = {
_: 'account.wallPapers',
- hash: number,
+ hash: string | number,
wallpapers: Array
};
}
@@ -7833,8 +7880,8 @@ export type InputTheme = InputTheme.inputTheme | InputTheme.inputThemeSlug;
export namespace InputTheme {
export type inputTheme = {
_: 'inputTheme',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
export type inputThemeSlug = {
@@ -7855,14 +7902,15 @@ export namespace Theme {
pFlags?: Partial<{
creator?: true,
default?: true,
+ for_chat?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
slug: string,
title: string,
document?: Document,
settings?: ThemeSettings,
- installs_count: number
+ installs_count?: number
};
}
@@ -7878,7 +7926,7 @@ export namespace AccountThemes {
export type accountThemes = {
_: 'account.themes',
- hash: number,
+ hash: string | number,
themes: Array
};
}
@@ -7973,10 +8021,13 @@ export namespace InputThemeSettings {
export type inputThemeSettings = {
_: 'inputThemeSettings',
flags?: number,
+ pFlags?: Partial<{
+ message_colors_animated?: true,
+ }>,
base_theme: BaseTheme,
accent_color: number,
- message_top_color?: number,
- message_bottom_color?: number,
+ outbox_accent_color?: number,
+ message_colors?: Array,
wallpaper?: InputWallPaper,
wallpaper_settings?: WallPaperSettings
};
@@ -7991,10 +8042,13 @@ export namespace ThemeSettings {
export type themeSettings = {
_: 'themeSettings',
flags?: number,
+ pFlags?: Partial<{
+ message_colors_animated?: true,
+ }>,
base_theme: BaseTheme,
accent_color: number,
- message_top_color?: number,
- message_bottom_color?: number,
+ outbox_accent_color?: number,
+ message_colors?: Array,
wallpaper?: WallPaper
};
}
@@ -8021,20 +8075,20 @@ export type MessageUserVote = MessageUserVote.messageUserVote | MessageUserVote.
export namespace MessageUserVote {
export type messageUserVote = {
_: 'messageUserVote',
- user_id: number,
+ user_id: string | number,
option: Uint8Array,
date: number
};
export type messageUserVoteInputOption = {
_: 'messageUserVoteInputOption',
- user_id: number,
+ user_id: string | number,
date: number
};
export type messageUserVoteMultiple = {
_: 'messageUserVoteMultiple',
- user_id: number,
+ user_id: string | number,
options: Array,
date: number
};
@@ -8108,7 +8162,7 @@ export namespace DialogFilter {
include_peers: Array,
exclude_peers: Array,
orderIndex?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10,
- peerId?: number,
+ peerId?: PeerId,
folder_id?: number
};
}
@@ -8280,7 +8334,7 @@ export type StatsGroupTopPoster = StatsGroupTopPoster.statsGroupTopPoster;
export namespace StatsGroupTopPoster {
export type statsGroupTopPoster = {
_: 'statsGroupTopPoster',
- user_id: number,
+ user_id: string | number,
messages: number,
avg_chars: number
};
@@ -8294,7 +8348,7 @@ export type StatsGroupTopAdmin = StatsGroupTopAdmin.statsGroupTopAdmin;
export namespace StatsGroupTopAdmin {
export type statsGroupTopAdmin = {
_: 'statsGroupTopAdmin',
- user_id: number,
+ user_id: string | number,
deleted: number,
kicked: number,
banned: number
@@ -8309,7 +8363,7 @@ export type StatsGroupTopInviter = StatsGroupTopInviter.statsGroupTopInviter;
export namespace StatsGroupTopInviter {
export type statsGroupTopInviter = {
_: 'statsGroupTopInviter',
- user_id: number,
+ user_id: string | number,
invitations: number
};
}
@@ -8448,6 +8502,7 @@ export namespace MessagesDiscussionMessage {
max_id?: number,
read_inbox_max_id?: number,
read_outbox_max_id?: number,
+ unread_count: number,
chats: Array,
users: Array
};
@@ -8483,7 +8538,7 @@ export namespace MessageReplies {
replies: number,
replies_pts: number,
recent_repliers?: Array,
- channel_id?: number,
+ channel_id?: string | number,
max_id?: number,
read_max_id?: number
};
@@ -8522,8 +8577,8 @@ export type GroupCall = GroupCall.groupCallDiscarded | GroupCall.groupCall;
export namespace GroupCall {
export type groupCallDiscarded = {
_: 'groupCallDiscarded',
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
duration: number
};
@@ -8536,9 +8591,10 @@ export namespace GroupCall {
join_date_asc?: true,
schedule_start_subscribed?: true,
can_start_video?: true,
+ record_video_active?: true,
}>,
- id: string,
- access_hash: string,
+ id: string | number,
+ access_hash: string | number,
participants_count: number,
title?: string,
stream_dc_id?: number,
@@ -8558,8 +8614,8 @@ export type InputGroupCall = InputGroupCall.inputGroupCall;
export namespace InputGroupCall {
export type inputGroupCall = {
_: 'inputGroupCall',
- id: string,
- access_hash: string
+ id: string | number,
+ access_hash: string | number
};
}
@@ -8590,7 +8646,7 @@ export namespace GroupCallParticipant {
source: number,
volume?: number,
about?: string,
- raise_hand_rating?: string,
+ raise_hand_rating?: string | number,
video?: GroupCallParticipantVideo,
presentation?: GroupCallParticipantVideo
};
@@ -8664,7 +8720,7 @@ export type MessagesHistoryImport = MessagesHistoryImport.messagesHistoryImport;
export namespace MessagesHistoryImport {
export type messagesHistoryImport = {
_: 'messages.historyImport',
- id: string
+ id: string | number
};
}
@@ -8708,7 +8764,7 @@ export type ChatInviteImporter = ChatInviteImporter.chatInviteImporter;
export namespace ChatInviteImporter {
export type chatInviteImporter = {
_: 'chatInviteImporter',
- user_id: number,
+ user_id: string | number,
date: number
};
}
@@ -8769,7 +8825,7 @@ export type ChatAdminWithInvites = ChatAdminWithInvites.chatAdminWithInvites;
export namespace ChatAdminWithInvites {
export type chatAdminWithInvites = {
_: 'chatAdminWithInvites',
- admin_id: number,
+ admin_id: string | number,
invites_count: number,
revoked_invites_count: number
};
@@ -8929,20 +8985,99 @@ export namespace AccountResetPasswordResult {
};
}
+/**
+ * @link https://core.telegram.org/type/ChatTheme
+ */
+export type ChatTheme = ChatTheme.chatTheme;
+
+export namespace ChatTheme {
+ export type chatTheme = {
+ _: 'chatTheme',
+ emoticon: string,
+ theme: Theme,
+ dark_theme: Theme
+ };
+}
+
+/**
+ * @link https://core.telegram.org/type/account.ChatThemes
+ */
+export type AccountChatThemes = AccountChatThemes.accountChatThemesNotModified | AccountChatThemes.accountChatThemes;
+
+export namespace AccountChatThemes {
+ export type accountChatThemesNotModified = {
+ _: 'account.chatThemesNotModified'
+ };
+
+ export type accountChatThemes = {
+ _: 'account.chatThemes',
+ hash: number,
+ themes: Array
+ };
+}
+
+/**
+ * @link https://core.telegram.org/type/SponsoredMessage
+ */
+export type SponsoredMessage = SponsoredMessage.sponsoredMessage;
+
+export namespace SponsoredMessage {
+ export type sponsoredMessage = {
+ _: 'sponsoredMessage',
+ flags?: number,
+ random_id: Uint8Array,
+ from_id: Peer,
+ start_param?: string,
+ message: string,
+ entities?: Array
+ };
+}
+
+/**
+ * @link https://core.telegram.org/type/messages.SponsoredMessages
+ */
+export type MessagesSponsoredMessages = MessagesSponsoredMessages.messagesSponsoredMessages;
+
+export namespace MessagesSponsoredMessages {
+ export type messagesSponsoredMessages = {
+ _: 'messages.sponsoredMessages',
+ messages: Array,
+ chats: Array,
+ users: Array
+ };
+}
+
export interface ConstructorDeclMap {
'error': Error.error,
'inputPeerEmpty': InputPeer.inputPeerEmpty,
'inputPeerSelf': InputPeer.inputPeerSelf,
'inputPeerChat': InputPeer.inputPeerChat,
+ 'inputPeerUser': InputPeer.inputPeerUser,
+ 'inputPeerChannel': InputPeer.inputPeerChannel,
+ 'inputPeerUserFromMessage': InputPeer.inputPeerUserFromMessage,
+ 'inputPeerChannelFromMessage': InputPeer.inputPeerChannelFromMessage,
'inputUserEmpty': InputUser.inputUserEmpty,
'inputUserSelf': InputUser.inputUserSelf,
+ 'inputUser': InputUser.inputUser,
+ 'inputUserFromMessage': InputUser.inputUserFromMessage,
'inputPhoneContact': InputContact.inputPhoneContact,
'inputFile': InputFile.inputFile,
+ 'inputFileBig': InputFile.inputFileBig,
'inputMediaEmpty': InputMedia.inputMediaEmpty,
'inputMediaUploadedPhoto': InputMedia.inputMediaUploadedPhoto,
'inputMediaPhoto': InputMedia.inputMediaPhoto,
'inputMediaGeoPoint': InputMedia.inputMediaGeoPoint,
'inputMediaContact': InputMedia.inputMediaContact,
+ 'inputMediaUploadedDocument': InputMedia.inputMediaUploadedDocument,
+ 'inputMediaDocument': InputMedia.inputMediaDocument,
+ 'inputMediaVenue': InputMedia.inputMediaVenue,
+ 'inputMediaPhotoExternal': InputMedia.inputMediaPhotoExternal,
+ 'inputMediaDocumentExternal': InputMedia.inputMediaDocumentExternal,
+ 'inputMediaGame': InputMedia.inputMediaGame,
+ 'inputMediaInvoice': InputMedia.inputMediaInvoice,
+ 'inputMediaGeoLive': InputMedia.inputMediaGeoLive,
+ 'inputMediaPoll': InputMedia.inputMediaPoll,
+ 'inputMediaDice': InputMedia.inputMediaDice,
'inputChatPhotoEmpty': InputChatPhoto.inputChatPhotoEmpty,
'inputChatUploadedPhoto': InputChatPhoto.inputChatUploadedPhoto,
'inputChatPhoto': InputChatPhoto.inputChatPhoto,
@@ -8951,8 +9086,18 @@ export interface ConstructorDeclMap {
'inputPhotoEmpty': InputPhoto.inputPhotoEmpty,
'inputPhoto': InputPhoto.inputPhoto,
'inputFileLocation': InputFileLocation.inputFileLocation,
+ 'inputEncryptedFileLocation': InputFileLocation.inputEncryptedFileLocation,
+ 'inputDocumentFileLocation': InputFileLocation.inputDocumentFileLocation,
+ 'inputSecureFileLocation': InputFileLocation.inputSecureFileLocation,
+ 'inputTakeoutFileLocation': InputFileLocation.inputTakeoutFileLocation,
+ 'inputPhotoFileLocation': InputFileLocation.inputPhotoFileLocation,
+ 'inputPhotoLegacyFileLocation': InputFileLocation.inputPhotoLegacyFileLocation,
+ 'inputPeerPhotoFileLocation': InputFileLocation.inputPeerPhotoFileLocation,
+ 'inputStickerSetThumb': InputFileLocation.inputStickerSetThumb,
+ 'inputGroupCallStream': InputFileLocation.inputGroupCallStream,
'peerUser': Peer.peerUser,
'peerChat': Peer.peerChat,
+ 'peerChannel': Peer.peerChannel,
'storage.fileUnknown': StorageFileType.storageFileUnknown,
'storage.filePartial': StorageFileType.storageFilePartial,
'storage.fileJpeg': StorageFileType.storageFileJpeg,
@@ -8964,16 +9109,25 @@ export interface ConstructorDeclMap {
'storage.fileMp4': StorageFileType.storageFileMp4,
'storage.fileWebp': StorageFileType.storageFileWebp,
'userEmpty': User.userEmpty,
+ 'user': User.user,
'userProfilePhotoEmpty': UserProfilePhoto.userProfilePhotoEmpty,
'userProfilePhoto': UserProfilePhoto.userProfilePhoto,
'userStatusEmpty': UserStatus.userStatusEmpty,
'userStatusOnline': UserStatus.userStatusOnline,
'userStatusOffline': UserStatus.userStatusOffline,
+ 'userStatusRecently': UserStatus.userStatusRecently,
+ 'userStatusLastWeek': UserStatus.userStatusLastWeek,
+ 'userStatusLastMonth': UserStatus.userStatusLastMonth,
'chatEmpty': Chat.chatEmpty,
'chat': Chat.chat,
'chatForbidden': Chat.chatForbidden,
+ 'channel': Chat.channel,
+ 'channelForbidden': Chat.channelForbidden,
'chatFull': ChatFull.chatFull,
+ 'channelFull': ChatFull.channelFull,
'chatParticipant': ChatParticipant.chatParticipant,
+ 'chatParticipantCreator': ChatParticipant.chatParticipantCreator,
+ 'chatParticipantAdmin': ChatParticipant.chatParticipantAdmin,
'chatParticipantsForbidden': ChatParticipants.chatParticipantsForbidden,
'chatParticipants': ChatParticipants.chatParticipants,
'chatPhotoEmpty': ChatPhoto.chatPhotoEmpty,
@@ -8986,6 +9140,14 @@ export interface ConstructorDeclMap {
'messageMediaGeo': MessageMedia.messageMediaGeo,
'messageMediaContact': MessageMedia.messageMediaContact,
'messageMediaUnsupported': MessageMedia.messageMediaUnsupported,
+ 'messageMediaDocument': MessageMedia.messageMediaDocument,
+ 'messageMediaWebPage': MessageMedia.messageMediaWebPage,
+ 'messageMediaVenue': MessageMedia.messageMediaVenue,
+ 'messageMediaGame': MessageMedia.messageMediaGame,
+ 'messageMediaInvoice': MessageMedia.messageMediaInvoice,
+ 'messageMediaGeoLive': MessageMedia.messageMediaGeoLive,
+ 'messageMediaPoll': MessageMedia.messageMediaPoll,
+ 'messageMediaDice': MessageMedia.messageMediaDice,
'messageActionEmpty': MessageAction.messageActionEmpty,
'messageActionChatCreate': MessageAction.messageActionChatCreate,
'messageActionChatEditTitle': MessageAction.messageActionChatEditTitle,
@@ -8993,29 +9155,61 @@ export interface ConstructorDeclMap {
'messageActionChatDeletePhoto': MessageAction.messageActionChatDeletePhoto,
'messageActionChatAddUser': MessageAction.messageActionChatAddUser,
'messageActionChatDeleteUser': MessageAction.messageActionChatDeleteUser,
+ 'messageActionChatJoinedByLink': MessageAction.messageActionChatJoinedByLink,
+ 'messageActionChannelCreate': MessageAction.messageActionChannelCreate,
+ 'messageActionChatMigrateTo': MessageAction.messageActionChatMigrateTo,
+ 'messageActionChannelMigrateFrom': MessageAction.messageActionChannelMigrateFrom,
+ 'messageActionPinMessage': MessageAction.messageActionPinMessage,
+ 'messageActionHistoryClear': MessageAction.messageActionHistoryClear,
+ 'messageActionGameScore': MessageAction.messageActionGameScore,
+ 'messageActionPaymentSentMe': MessageAction.messageActionPaymentSentMe,
+ 'messageActionPaymentSent': MessageAction.messageActionPaymentSent,
+ 'messageActionPhoneCall': MessageAction.messageActionPhoneCall,
+ 'messageActionScreenshotTaken': MessageAction.messageActionScreenshotTaken,
+ 'messageActionCustomAction': MessageAction.messageActionCustomAction,
+ 'messageActionBotAllowed': MessageAction.messageActionBotAllowed,
+ 'messageActionSecureValuesSentMe': MessageAction.messageActionSecureValuesSentMe,
+ 'messageActionSecureValuesSent': MessageAction.messageActionSecureValuesSent,
+ 'messageActionContactSignUp': MessageAction.messageActionContactSignUp,
+ 'messageActionGeoProximityReached': MessageAction.messageActionGeoProximityReached,
+ 'messageActionGroupCall': MessageAction.messageActionGroupCall,
+ 'messageActionInviteToGroupCall': MessageAction.messageActionInviteToGroupCall,
+ 'messageActionSetMessagesTTL': MessageAction.messageActionSetMessagesTTL,
+ 'messageActionGroupCallScheduled': MessageAction.messageActionGroupCallScheduled,
+ 'messageActionSetChatTheme': MessageAction.messageActionSetChatTheme,
'dialog': Dialog.dialog,
+ 'dialogFolder': Dialog.dialogFolder,
'photoEmpty': Photo.photoEmpty,
'photo': Photo.photo,
'photoSizeEmpty': PhotoSize.photoSizeEmpty,
'photoSize': PhotoSize.photoSize,
'photoCachedSize': PhotoSize.photoCachedSize,
+ 'photoStrippedSize': PhotoSize.photoStrippedSize,
+ 'photoSizeProgressive': PhotoSize.photoSizeProgressive,
+ 'photoPathSize': PhotoSize.photoPathSize,
'geoPointEmpty': GeoPoint.geoPointEmpty,
'geoPoint': GeoPoint.geoPoint,
'auth.sentCode': AuthSentCode.authSentCode,
'auth.authorization': AuthAuthorization.authAuthorization,
+ 'auth.authorizationSignUpRequired': AuthAuthorization.authAuthorizationSignUpRequired,
'auth.exportedAuthorization': AuthExportedAuthorization.authExportedAuthorization,
'inputNotifyPeer': InputNotifyPeer.inputNotifyPeer,
'inputNotifyUsers': InputNotifyPeer.inputNotifyUsers,
'inputNotifyChats': InputNotifyPeer.inputNotifyChats,
+ 'inputNotifyBroadcasts': InputNotifyPeer.inputNotifyBroadcasts,
'inputPeerNotifySettings': InputPeerNotifySettings.inputPeerNotifySettings,
'peerNotifySettings': PeerNotifySettings.peerNotifySettings,
'peerSettings': PeerSettings.peerSettings,
'wallPaper': WallPaper.wallPaper,
+ 'wallPaperNoFile': WallPaper.wallPaperNoFile,
'inputReportReasonSpam': ReportReason.inputReportReasonSpam,
'inputReportReasonViolence': ReportReason.inputReportReasonViolence,
'inputReportReasonPornography': ReportReason.inputReportReasonPornography,
'inputReportReasonChildAbuse': ReportReason.inputReportReasonChildAbuse,
'inputReportReasonOther': ReportReason.inputReportReasonOther,
+ 'inputReportReasonCopyright': ReportReason.inputReportReasonCopyright,
+ 'inputReportReasonGeoIrrelevant': ReportReason.inputReportReasonGeoIrrelevant,
+ 'inputReportReasonFake': ReportReason.inputReportReasonFake,
'userFull': UserFull.userFull,
'contact': Contact.contact,
'importedContact': ImportedContact.importedContact,
@@ -9027,9 +9221,13 @@ export interface ConstructorDeclMap {
'contacts.blockedSlice': ContactsBlocked.contactsBlockedSlice,
'messages.dialogs': MessagesDialogs.messagesDialogs,
'messages.dialogsSlice': MessagesDialogs.messagesDialogsSlice,
+ 'messages.dialogsNotModified': MessagesDialogs.messagesDialogsNotModified,
'messages.messages': MessagesMessages.messagesMessages,
'messages.messagesSlice': MessagesMessages.messagesMessagesSlice,
+ 'messages.channelMessages': MessagesMessages.messagesChannelMessages,
+ 'messages.messagesNotModified': MessagesMessages.messagesMessagesNotModified,
'messages.chats': MessagesChats.messagesChats,
+ 'messages.chatsSlice': MessagesChats.messagesChatsSlice,
'messages.chatFull': MessagesChatFull.messagesChatFull,
'messages.affectedHistory': MessagesAffectedHistory.messagesAffectedHistory,
'inputMessagesFilterEmpty': MessagesFilter.inputMessagesFilterEmpty,
@@ -9039,6 +9237,16 @@ export interface ConstructorDeclMap {
'inputMessagesFilterDocument': MessagesFilter.inputMessagesFilterDocument,
'inputMessagesFilterUrl': MessagesFilter.inputMessagesFilterUrl,
'inputMessagesFilterGif': MessagesFilter.inputMessagesFilterGif,
+ 'inputMessagesFilterVoice': MessagesFilter.inputMessagesFilterVoice,
+ 'inputMessagesFilterMusic': MessagesFilter.inputMessagesFilterMusic,
+ 'inputMessagesFilterChatPhotos': MessagesFilter.inputMessagesFilterChatPhotos,
+ 'inputMessagesFilterPhoneCalls': MessagesFilter.inputMessagesFilterPhoneCalls,
+ 'inputMessagesFilterRoundVoice': MessagesFilter.inputMessagesFilterRoundVoice,
+ 'inputMessagesFilterRoundVideo': MessagesFilter.inputMessagesFilterRoundVideo,
+ 'inputMessagesFilterMyMentions': MessagesFilter.inputMessagesFilterMyMentions,
+ 'inputMessagesFilterGeo': MessagesFilter.inputMessagesFilterGeo,
+ 'inputMessagesFilterContacts': MessagesFilter.inputMessagesFilterContacts,
+ 'inputMessagesFilterPinned': MessagesFilter.inputMessagesFilterPinned,
'updateNewMessage': Update.updateNewMessage,
'updateMessageID': Update.updateMessageID,
'updateDeleteMessages': Update.updateDeleteMessages,
@@ -9048,30 +9256,113 @@ export interface ConstructorDeclMap {
'updateUserStatus': Update.updateUserStatus,
'updateUserName': Update.updateUserName,
'updateUserPhoto': Update.updateUserPhoto,
+ 'updateNewEncryptedMessage': Update.updateNewEncryptedMessage,
+ 'updateEncryptedChatTyping': Update.updateEncryptedChatTyping,
+ 'updateEncryption': Update.updateEncryption,
+ 'updateEncryptedMessagesRead': Update.updateEncryptedMessagesRead,
+ 'updateChatParticipantAdd': Update.updateChatParticipantAdd,
+ 'updateChatParticipantDelete': Update.updateChatParticipantDelete,
+ 'updateDcOptions': Update.updateDcOptions,
+ 'updateNotifySettings': Update.updateNotifySettings,
+ 'updateServiceNotification': Update.updateServiceNotification,
+ 'updatePrivacy': Update.updatePrivacy,
+ 'updateUserPhone': Update.updateUserPhone,
+ 'updateReadHistoryInbox': Update.updateReadHistoryInbox,
+ 'updateReadHistoryOutbox': Update.updateReadHistoryOutbox,
+ 'updateWebPage': Update.updateWebPage,
+ 'updateReadMessagesContents': Update.updateReadMessagesContents,
+ 'updateChannelTooLong': Update.updateChannelTooLong,
+ 'updateChannel': Update.updateChannel,
+ 'updateNewChannelMessage': Update.updateNewChannelMessage,
+ 'updateReadChannelInbox': Update.updateReadChannelInbox,
+ 'updateDeleteChannelMessages': Update.updateDeleteChannelMessages,
+ 'updateChannelMessageViews': Update.updateChannelMessageViews,
+ 'updateChatParticipantAdmin': Update.updateChatParticipantAdmin,
+ 'updateNewStickerSet': Update.updateNewStickerSet,
+ 'updateStickerSetsOrder': Update.updateStickerSetsOrder,
+ 'updateStickerSets': Update.updateStickerSets,
+ 'updateSavedGifs': Update.updateSavedGifs,
+ 'updateBotInlineQuery': Update.updateBotInlineQuery,
+ 'updateBotInlineSend': Update.updateBotInlineSend,
+ 'updateEditChannelMessage': Update.updateEditChannelMessage,
+ 'updateBotCallbackQuery': Update.updateBotCallbackQuery,
+ 'updateEditMessage': Update.updateEditMessage,
+ 'updateInlineBotCallbackQuery': Update.updateInlineBotCallbackQuery,
+ 'updateReadChannelOutbox': Update.updateReadChannelOutbox,
+ 'updateDraftMessage': Update.updateDraftMessage,
+ 'updateReadFeaturedStickers': Update.updateReadFeaturedStickers,
+ 'updateRecentStickers': Update.updateRecentStickers,
+ 'updateConfig': Update.updateConfig,
+ 'updatePtsChanged': Update.updatePtsChanged,
+ 'updateChannelWebPage': Update.updateChannelWebPage,
+ 'updateDialogPinned': Update.updateDialogPinned,
+ 'updatePinnedDialogs': Update.updatePinnedDialogs,
+ 'updateBotWebhookJSON': Update.updateBotWebhookJSON,
+ 'updateBotWebhookJSONQuery': Update.updateBotWebhookJSONQuery,
+ 'updateBotShippingQuery': Update.updateBotShippingQuery,
+ 'updateBotPrecheckoutQuery': Update.updateBotPrecheckoutQuery,
+ 'updatePhoneCall': Update.updatePhoneCall,
+ 'updateLangPackTooLong': Update.updateLangPackTooLong,
+ 'updateLangPack': Update.updateLangPack,
+ 'updateFavedStickers': Update.updateFavedStickers,
+ 'updateChannelReadMessagesContents': Update.updateChannelReadMessagesContents,
+ 'updateContactsReset': Update.updateContactsReset,
+ 'updateChannelAvailableMessages': Update.updateChannelAvailableMessages,
+ 'updateDialogUnreadMark': Update.updateDialogUnreadMark,
+ 'updateMessagePoll': Update.updateMessagePoll,
+ 'updateChatDefaultBannedRights': Update.updateChatDefaultBannedRights,
+ 'updateFolderPeers': Update.updateFolderPeers,
+ 'updatePeerSettings': Update.updatePeerSettings,
+ 'updatePeerLocated': Update.updatePeerLocated,
+ 'updateNewScheduledMessage': Update.updateNewScheduledMessage,
+ 'updateDeleteScheduledMessages': Update.updateDeleteScheduledMessages,
+ 'updateTheme': Update.updateTheme,
+ 'updateGeoLiveViewed': Update.updateGeoLiveViewed,
+ 'updateLoginToken': Update.updateLoginToken,
+ 'updateMessagePollVote': Update.updateMessagePollVote,
+ 'updateDialogFilter': Update.updateDialogFilter,
+ 'updateDialogFilterOrder': Update.updateDialogFilterOrder,
+ 'updateDialogFilters': Update.updateDialogFilters,
+ 'updatePhoneCallSignalingData': Update.updatePhoneCallSignalingData,
+ 'updateChannelMessageForwards': Update.updateChannelMessageForwards,
+ 'updateReadChannelDiscussionInbox': Update.updateReadChannelDiscussionInbox,
+ 'updateReadChannelDiscussionOutbox': Update.updateReadChannelDiscussionOutbox,
+ 'updatePeerBlocked': Update.updatePeerBlocked,
+ 'updateChannelUserTyping': Update.updateChannelUserTyping,
+ 'updatePinnedMessages': Update.updatePinnedMessages,
+ 'updatePinnedChannelMessages': Update.updatePinnedChannelMessages,
+ 'updateChat': Update.updateChat,
+ 'updateGroupCallParticipants': Update.updateGroupCallParticipants,
+ 'updateGroupCall': Update.updateGroupCall,
+ 'updatePeerHistoryTTL': Update.updatePeerHistoryTTL,
+ 'updateChatParticipant': Update.updateChatParticipant,
+ 'updateChannelParticipant': Update.updateChannelParticipant,
+ 'updateBotStopped': Update.updateBotStopped,
+ 'updateGroupCallConnection': Update.updateGroupCallConnection,
+ 'updateBotCommands': Update.updateBotCommands,
'updates.state': UpdatesState.updatesState,
'updates.differenceEmpty': UpdatesDifference.updatesDifferenceEmpty,
'updates.difference': UpdatesDifference.updatesDifference,
'updates.differenceSlice': UpdatesDifference.updatesDifferenceSlice,
+ 'updates.differenceTooLong': UpdatesDifference.updatesDifferenceTooLong,
'updatesTooLong': Updates.updatesTooLong,
'updateShortMessage': Updates.updateShortMessage,
'updateShortChatMessage': Updates.updateShortChatMessage,
'updateShort': Updates.updateShort,
'updatesCombined': Updates.updatesCombined,
'updates': Updates.updates,
+ 'updateShortSentMessage': Updates.updateShortSentMessage,
'photos.photos': PhotosPhotos.photosPhotos,
'photos.photosSlice': PhotosPhotos.photosPhotosSlice,
'photos.photo': PhotosPhoto.photosPhoto,
'upload.file': UploadFile.uploadFile,
+ 'upload.fileCdnRedirect': UploadFile.uploadFileCdnRedirect,
'dcOption': DcOption.dcOption,
'config': Config.config,
'nearestDc': NearestDc.nearestDc,
'help.appUpdate': HelpAppUpdate.helpAppUpdate,
'help.noAppUpdate': HelpAppUpdate.helpNoAppUpdate,
'help.inviteText': HelpInviteText.helpInviteText,
- 'updateNewEncryptedMessage': Update.updateNewEncryptedMessage,
- 'updateEncryptedChatTyping': Update.updateEncryptedChatTyping,
- 'updateEncryption': Update.updateEncryption,
- 'updateEncryptedMessagesRead': Update.updateEncryptedMessagesRead,
'encryptedChatEmpty': EncryptedChat.encryptedChatEmpty,
'encryptedChatWaiting': EncryptedChat.encryptedChatWaiting,
'encryptedChatRequested': EncryptedChat.encryptedChatRequested,
@@ -9083,31 +9374,22 @@ export interface ConstructorDeclMap {
'inputEncryptedFileEmpty': InputEncryptedFile.inputEncryptedFileEmpty,
'inputEncryptedFileUploaded': InputEncryptedFile.inputEncryptedFileUploaded,
'inputEncryptedFile': InputEncryptedFile.inputEncryptedFile,
- 'inputEncryptedFileLocation': InputFileLocation.inputEncryptedFileLocation,
+ 'inputEncryptedFileBigUploaded': InputEncryptedFile.inputEncryptedFileBigUploaded,
'encryptedMessage': EncryptedMessage.encryptedMessage,
'encryptedMessageService': EncryptedMessage.encryptedMessageService,
'messages.dhConfigNotModified': MessagesDhConfig.messagesDhConfigNotModified,
'messages.dhConfig': MessagesDhConfig.messagesDhConfig,
'messages.sentEncryptedMessage': MessagesSentEncryptedMessage.messagesSentEncryptedMessage,
'messages.sentEncryptedFile': MessagesSentEncryptedMessage.messagesSentEncryptedFile,
- 'inputFileBig': InputFile.inputFileBig,
- 'inputEncryptedFileBigUploaded': InputEncryptedFile.inputEncryptedFileBigUploaded,
- 'updateChatParticipantAdd': Update.updateChatParticipantAdd,
- 'updateChatParticipantDelete': Update.updateChatParticipantDelete,
- 'updateDcOptions': Update.updateDcOptions,
- 'inputMediaUploadedDocument': InputMedia.inputMediaUploadedDocument,
- 'inputMediaDocument': InputMedia.inputMediaDocument,
- 'messageMediaDocument': MessageMedia.messageMediaDocument,
'inputDocumentEmpty': InputDocument.inputDocumentEmpty,
'inputDocument': InputDocument.inputDocument,
- 'inputDocumentFileLocation': InputFileLocation.inputDocumentFileLocation,
'documentEmpty': Document.documentEmpty,
'document': Document.document,
'help.support': HelpSupport.helpSupport,
'notifyPeer': NotifyPeer.notifyPeer,
'notifyUsers': NotifyPeer.notifyUsers,
'notifyChats': NotifyPeer.notifyChats,
- 'updateNotifySettings': Update.updateNotifySettings,
+ 'notifyBroadcasts': NotifyPeer.notifyBroadcasts,
'sendMessageTypingAction': SendMessageAction.sendMessageTypingAction,
'sendMessageCancelAction': SendMessageAction.sendMessageCancelAction,
'sendMessageRecordVideoAction': SendMessageAction.sendMessageRecordVideoAction,
@@ -9118,77 +9400,102 @@ export interface ConstructorDeclMap {
'sendMessageUploadDocumentAction': SendMessageAction.sendMessageUploadDocumentAction,
'sendMessageGeoLocationAction': SendMessageAction.sendMessageGeoLocationAction,
'sendMessageChooseContactAction': SendMessageAction.sendMessageChooseContactAction,
+ 'sendMessageGamePlayAction': SendMessageAction.sendMessageGamePlayAction,
+ 'sendMessageRecordRoundAction': SendMessageAction.sendMessageRecordRoundAction,
+ 'sendMessageUploadRoundAction': SendMessageAction.sendMessageUploadRoundAction,
+ 'speakingInGroupCallAction': SendMessageAction.speakingInGroupCallAction,
+ 'sendMessageHistoryImportAction': SendMessageAction.sendMessageHistoryImportAction,
+ 'sendMessageChooseStickerAction': SendMessageAction.sendMessageChooseStickerAction,
+ 'sendMessageEmojiInteraction': SendMessageAction.sendMessageEmojiInteraction,
+ 'sendMessageEmojiInteractionSeen': SendMessageAction.sendMessageEmojiInteractionSeen,
'contacts.found': ContactsFound.contactsFound,
- 'updateServiceNotification': Update.updateServiceNotification,
- 'userStatusRecently': UserStatus.userStatusRecently,
- 'userStatusLastWeek': UserStatus.userStatusLastWeek,
- 'userStatusLastMonth': UserStatus.userStatusLastMonth,
- 'updatePrivacy': Update.updatePrivacy,
'inputPrivacyKeyStatusTimestamp': InputPrivacyKey.inputPrivacyKeyStatusTimestamp,
+ 'inputPrivacyKeyChatInvite': InputPrivacyKey.inputPrivacyKeyChatInvite,
+ 'inputPrivacyKeyPhoneCall': InputPrivacyKey.inputPrivacyKeyPhoneCall,
+ 'inputPrivacyKeyPhoneP2P': InputPrivacyKey.inputPrivacyKeyPhoneP2P,
+ 'inputPrivacyKeyForwards': InputPrivacyKey.inputPrivacyKeyForwards,
+ 'inputPrivacyKeyProfilePhoto': InputPrivacyKey.inputPrivacyKeyProfilePhoto,
+ 'inputPrivacyKeyPhoneNumber': InputPrivacyKey.inputPrivacyKeyPhoneNumber,
+ 'inputPrivacyKeyAddedByPhone': InputPrivacyKey.inputPrivacyKeyAddedByPhone,
'privacyKeyStatusTimestamp': PrivacyKey.privacyKeyStatusTimestamp,
+ 'privacyKeyChatInvite': PrivacyKey.privacyKeyChatInvite,
+ 'privacyKeyPhoneCall': PrivacyKey.privacyKeyPhoneCall,
+ 'privacyKeyPhoneP2P': PrivacyKey.privacyKeyPhoneP2P,
+ 'privacyKeyForwards': PrivacyKey.privacyKeyForwards,
+ 'privacyKeyProfilePhoto': PrivacyKey.privacyKeyProfilePhoto,
+ 'privacyKeyPhoneNumber': PrivacyKey.privacyKeyPhoneNumber,
+ 'privacyKeyAddedByPhone': PrivacyKey.privacyKeyAddedByPhone,
'inputPrivacyValueAllowContacts': InputPrivacyRule.inputPrivacyValueAllowContacts,
'inputPrivacyValueAllowAll': InputPrivacyRule.inputPrivacyValueAllowAll,
'inputPrivacyValueAllowUsers': InputPrivacyRule.inputPrivacyValueAllowUsers,
'inputPrivacyValueDisallowContacts': InputPrivacyRule.inputPrivacyValueDisallowContacts,
'inputPrivacyValueDisallowAll': InputPrivacyRule.inputPrivacyValueDisallowAll,
'inputPrivacyValueDisallowUsers': InputPrivacyRule.inputPrivacyValueDisallowUsers,
+ 'inputPrivacyValueAllowChatParticipants': InputPrivacyRule.inputPrivacyValueAllowChatParticipants,
+ 'inputPrivacyValueDisallowChatParticipants': InputPrivacyRule.inputPrivacyValueDisallowChatParticipants,
'privacyValueAllowContacts': PrivacyRule.privacyValueAllowContacts,
'privacyValueAllowAll': PrivacyRule.privacyValueAllowAll,
'privacyValueAllowUsers': PrivacyRule.privacyValueAllowUsers,
'privacyValueDisallowContacts': PrivacyRule.privacyValueDisallowContacts,
'privacyValueDisallowAll': PrivacyRule.privacyValueDisallowAll,
'privacyValueDisallowUsers': PrivacyRule.privacyValueDisallowUsers,
+ 'privacyValueAllowChatParticipants': PrivacyRule.privacyValueAllowChatParticipants,
+ 'privacyValueDisallowChatParticipants': PrivacyRule.privacyValueDisallowChatParticipants,
'account.privacyRules': AccountPrivacyRules.accountPrivacyRules,
'accountDaysTTL': AccountDaysTTL.accountDaysTTL,
- 'updateUserPhone': Update.updateUserPhone,
'documentAttributeImageSize': DocumentAttribute.documentAttributeImageSize,
'documentAttributeAnimated': DocumentAttribute.documentAttributeAnimated,
'documentAttributeSticker': DocumentAttribute.documentAttributeSticker,
'documentAttributeVideo': DocumentAttribute.documentAttributeVideo,
'documentAttributeAudio': DocumentAttribute.documentAttributeAudio,
'documentAttributeFilename': DocumentAttribute.documentAttributeFilename,
+ 'documentAttributeHasStickers': DocumentAttribute.documentAttributeHasStickers,
'messages.stickersNotModified': MessagesStickers.messagesStickersNotModified,
'messages.stickers': MessagesStickers.messagesStickers,
'stickerPack': StickerPack.stickerPack,
'messages.allStickersNotModified': MessagesAllStickers.messagesAllStickersNotModified,
'messages.allStickers': MessagesAllStickers.messagesAllStickers,
- 'updateReadHistoryInbox': Update.updateReadHistoryInbox,
- 'updateReadHistoryOutbox': Update.updateReadHistoryOutbox,
'messages.affectedMessages': MessagesAffectedMessages.messagesAffectedMessages,
- 'updateWebPage': Update.updateWebPage,
'webPageEmpty': WebPage.webPageEmpty,
'webPagePending': WebPage.webPagePending,
'webPage': WebPage.webPage,
- 'messageMediaWebPage': MessageMedia.messageMediaWebPage,
+ 'webPageNotModified': WebPage.webPageNotModified,
'authorization': Authorization.authorization,
'account.authorizations': AccountAuthorizations.accountAuthorizations,
'account.password': AccountPassword.accountPassword,
'account.passwordSettings': AccountPasswordSettings.accountPasswordSettings,
'account.passwordInputSettings': AccountPasswordInputSettings.accountPasswordInputSettings,
'auth.passwordRecovery': AuthPasswordRecovery.authPasswordRecovery,
- 'inputMediaVenue': InputMedia.inputMediaVenue,
- 'messageMediaVenue': MessageMedia.messageMediaVenue,
'receivedNotifyMessage': ReceivedNotifyMessage.receivedNotifyMessage,
'chatInviteExported': ExportedChatInvite.chatInviteExported,
'chatInviteAlready': ChatInvite.chatInviteAlready,
'chatInvite': ChatInvite.chatInvite,
- 'messageActionChatJoinedByLink': MessageAction.messageActionChatJoinedByLink,
- 'updateReadMessagesContents': Update.updateReadMessagesContents,
+ 'chatInvitePeek': ChatInvite.chatInvitePeek,
'inputStickerSetEmpty': InputStickerSet.inputStickerSetEmpty,
'inputStickerSetID': InputStickerSet.inputStickerSetID,
'inputStickerSetShortName': InputStickerSet.inputStickerSetShortName,
+ 'inputStickerSetAnimatedEmoji': InputStickerSet.inputStickerSetAnimatedEmoji,
+ 'inputStickerSetDice': InputStickerSet.inputStickerSetDice,
'stickerSet': StickerSet.stickerSet,
'messages.stickerSet': MessagesStickerSet.messagesStickerSet,
- 'user': User.user,
'botCommand': BotCommand.botCommand,
'botInfo': BotInfo.botInfo,
'keyboardButton': KeyboardButton.keyboardButton,
+ 'keyboardButtonUrl': KeyboardButton.keyboardButtonUrl,
+ 'keyboardButtonCallback': KeyboardButton.keyboardButtonCallback,
+ 'keyboardButtonRequestPhone': KeyboardButton.keyboardButtonRequestPhone,
+ 'keyboardButtonRequestGeoLocation': KeyboardButton.keyboardButtonRequestGeoLocation,
+ 'keyboardButtonSwitchInline': KeyboardButton.keyboardButtonSwitchInline,
+ 'keyboardButtonGame': KeyboardButton.keyboardButtonGame,
+ 'keyboardButtonBuy': KeyboardButton.keyboardButtonBuy,
+ 'keyboardButtonUrlAuth': KeyboardButton.keyboardButtonUrlAuth,
+ 'inputKeyboardButtonUrlAuth': KeyboardButton.inputKeyboardButtonUrlAuth,
+ 'keyboardButtonRequestPoll': KeyboardButton.keyboardButtonRequestPoll,
'keyboardButtonRow': KeyboardButtonRow.keyboardButtonRow,
'replyKeyboardHide': ReplyMarkup.replyKeyboardHide,
'replyKeyboardForceReply': ReplyMarkup.replyKeyboardForceReply,
'replyKeyboardMarkup': ReplyMarkup.replyKeyboardMarkup,
- 'inputPeerUser': InputPeer.inputPeerUser,
- 'inputUser': InputUser.inputUser,
+ 'replyInlineMarkup': ReplyMarkup.replyInlineMarkup,
'messageEntityUnknown': MessageEntity.messageEntityUnknown,
'messageEntityMention': MessageEntity.messageEntityMention,
'messageEntityHashtag': MessageEntity.messageEntityHashtag,
@@ -9200,24 +9507,19 @@ export interface ConstructorDeclMap {
'messageEntityCode': MessageEntity.messageEntityCode,
'messageEntityPre': MessageEntity.messageEntityPre,
'messageEntityTextUrl': MessageEntity.messageEntityTextUrl,
- 'updateShortSentMessage': Updates.updateShortSentMessage,
+ 'messageEntityMentionName': MessageEntity.messageEntityMentionName,
+ 'inputMessageEntityMentionName': MessageEntity.inputMessageEntityMentionName,
+ 'messageEntityPhone': MessageEntity.messageEntityPhone,
+ 'messageEntityCashtag': MessageEntity.messageEntityCashtag,
+ 'messageEntityUnderline': MessageEntity.messageEntityUnderline,
+ 'messageEntityStrike': MessageEntity.messageEntityStrike,
+ 'messageEntityBlockquote': MessageEntity.messageEntityBlockquote,
+ 'messageEntityBankCard': MessageEntity.messageEntityBankCard,
'inputChannelEmpty': InputChannel.inputChannelEmpty,
'inputChannel': InputChannel.inputChannel,
- 'peerChannel': Peer.peerChannel,
- 'inputPeerChannel': InputPeer.inputPeerChannel,
- 'channel': Chat.channel,
- 'channelForbidden': Chat.channelForbidden,
+ 'inputChannelFromMessage': InputChannel.inputChannelFromMessage,
'contacts.resolvedPeer': ContactsResolvedPeer.contactsResolvedPeer,
- 'channelFull': ChatFull.channelFull,
'messageRange': MessageRange.messageRange,
- 'messages.channelMessages': MessagesMessages.messagesChannelMessages,
- 'messageActionChannelCreate': MessageAction.messageActionChannelCreate,
- 'updateChannelTooLong': Update.updateChannelTooLong,
- 'updateChannel': Update.updateChannel,
- 'updateNewChannelMessage': Update.updateNewChannelMessage,
- 'updateReadChannelInbox': Update.updateReadChannelInbox,
- 'updateDeleteChannelMessages': Update.updateDeleteChannelMessages,
- 'updateChannelMessageViews': Update.updateChannelMessageViews,
'updates.channelDifferenceEmpty': UpdatesChannelDifference.updatesChannelDifferenceEmpty,
'updates.channelDifferenceTooLong': UpdatesChannelDifference.updatesChannelDifferenceTooLong,
'updates.channelDifference': UpdatesChannelDifference.updatesChannelDifference,
@@ -9226,41 +9528,45 @@ export interface ConstructorDeclMap {
'channelParticipant': ChannelParticipant.channelParticipant,
'channelParticipantSelf': ChannelParticipant.channelParticipantSelf,
'channelParticipantCreator': ChannelParticipant.channelParticipantCreator,
+ 'channelParticipantAdmin': ChannelParticipant.channelParticipantAdmin,
+ 'channelParticipantBanned': ChannelParticipant.channelParticipantBanned,
+ 'channelParticipantLeft': ChannelParticipant.channelParticipantLeft,
'channelParticipantsRecent': ChannelParticipantsFilter.channelParticipantsRecent,
'channelParticipantsAdmins': ChannelParticipantsFilter.channelParticipantsAdmins,
'channelParticipantsKicked': ChannelParticipantsFilter.channelParticipantsKicked,
- 'channels.channelParticipants': ChannelsChannelParticipants.channelsChannelParticipants,
- 'channels.channelParticipant': ChannelsChannelParticipant.channelsChannelParticipant,
- 'chatParticipantCreator': ChatParticipant.chatParticipantCreator,
- 'chatParticipantAdmin': ChatParticipant.chatParticipantAdmin,
- 'updateChatParticipantAdmin': Update.updateChatParticipantAdmin,
- 'messageActionChatMigrateTo': MessageAction.messageActionChatMigrateTo,
- 'messageActionChannelMigrateFrom': MessageAction.messageActionChannelMigrateFrom,
'channelParticipantsBots': ChannelParticipantsFilter.channelParticipantsBots,
+ 'channelParticipantsBanned': ChannelParticipantsFilter.channelParticipantsBanned,
+ 'channelParticipantsSearch': ChannelParticipantsFilter.channelParticipantsSearch,
+ 'channelParticipantsContacts': ChannelParticipantsFilter.channelParticipantsContacts,
+ 'channelParticipantsMentions': ChannelParticipantsFilter.channelParticipantsMentions,
+ 'channels.channelParticipants': ChannelsChannelParticipants.channelsChannelParticipants,
+ 'channels.channelParticipantsNotModified': ChannelsChannelParticipants.channelsChannelParticipantsNotModified,
+ 'channels.channelParticipant': ChannelsChannelParticipant.channelsChannelParticipant,
'help.termsOfService': HelpTermsOfService.helpTermsOfService,
- 'updateNewStickerSet': Update.updateNewStickerSet,
- 'updateStickerSetsOrder': Update.updateStickerSetsOrder,
- 'updateStickerSets': Update.updateStickerSets,
'messages.savedGifsNotModified': MessagesSavedGifs.messagesSavedGifsNotModified,
'messages.savedGifs': MessagesSavedGifs.messagesSavedGifs,
- 'updateSavedGifs': Update.updateSavedGifs,
'inputBotInlineMessageMediaAuto': InputBotInlineMessage.inputBotInlineMessageMediaAuto,
'inputBotInlineMessageText': InputBotInlineMessage.inputBotInlineMessageText,
+ 'inputBotInlineMessageMediaGeo': InputBotInlineMessage.inputBotInlineMessageMediaGeo,
+ 'inputBotInlineMessageMediaVenue': InputBotInlineMessage.inputBotInlineMessageMediaVenue,
+ 'inputBotInlineMessageMediaContact': InputBotInlineMessage.inputBotInlineMessageMediaContact,
+ 'inputBotInlineMessageGame': InputBotInlineMessage.inputBotInlineMessageGame,
+ 'inputBotInlineMessageMediaInvoice': InputBotInlineMessage.inputBotInlineMessageMediaInvoice,
'inputBotInlineResult': InputBotInlineResult.inputBotInlineResult,
+ 'inputBotInlineResultPhoto': InputBotInlineResult.inputBotInlineResultPhoto,
+ 'inputBotInlineResultDocument': InputBotInlineResult.inputBotInlineResultDocument,
+ 'inputBotInlineResultGame': InputBotInlineResult.inputBotInlineResultGame,
'botInlineMessageMediaAuto': BotInlineMessage.botInlineMessageMediaAuto,
'botInlineMessageText': BotInlineMessage.botInlineMessageText,
+ 'botInlineMessageMediaGeo': BotInlineMessage.botInlineMessageMediaGeo,
+ 'botInlineMessageMediaVenue': BotInlineMessage.botInlineMessageMediaVenue,
+ 'botInlineMessageMediaContact': BotInlineMessage.botInlineMessageMediaContact,
+ 'botInlineMessageMediaInvoice': BotInlineMessage.botInlineMessageMediaInvoice,
'botInlineResult': BotInlineResult.botInlineResult,
+ 'botInlineMediaResult': BotInlineResult.botInlineMediaResult,
'messages.botResults': MessagesBotResults.messagesBotResults,
- 'updateBotInlineQuery': Update.updateBotInlineQuery,
- 'updateBotInlineSend': Update.updateBotInlineSend,
- 'inputMessagesFilterVoice': MessagesFilter.inputMessagesFilterVoice,
- 'inputMessagesFilterMusic': MessagesFilter.inputMessagesFilterMusic,
- 'inputPrivacyKeyChatInvite': InputPrivacyKey.inputPrivacyKeyChatInvite,
- 'privacyKeyChatInvite': PrivacyKey.privacyKeyChatInvite,
'exportedMessageLink': ExportedMessageLink.exportedMessageLink,
'messageFwdHeader': MessageFwdHeader.messageFwdHeader,
- 'updateEditChannelMessage': Update.updateEditChannelMessage,
- 'messageActionPinMessage': MessageAction.messageActionPinMessage,
'auth.codeTypeSms': AuthCodeType.authCodeTypeSms,
'auth.codeTypeCall': AuthCodeType.authCodeTypeCall,
'auth.codeTypeFlashCall': AuthCodeType.authCodeTypeFlashCall,
@@ -9268,27 +9574,10 @@ export interface ConstructorDeclMap {
'auth.sentCodeTypeSms': AuthSentCodeType.authSentCodeTypeSms,
'auth.sentCodeTypeCall': AuthSentCodeType.authSentCodeTypeCall,
'auth.sentCodeTypeFlashCall': AuthSentCodeType.authSentCodeTypeFlashCall,
- 'keyboardButtonUrl': KeyboardButton.keyboardButtonUrl,
- 'keyboardButtonCallback': KeyboardButton.keyboardButtonCallback,
- 'keyboardButtonRequestPhone': KeyboardButton.keyboardButtonRequestPhone,
- 'keyboardButtonRequestGeoLocation': KeyboardButton.keyboardButtonRequestGeoLocation,
- 'keyboardButtonSwitchInline': KeyboardButton.keyboardButtonSwitchInline,
- 'replyInlineMarkup': ReplyMarkup.replyInlineMarkup,
'messages.botCallbackAnswer': MessagesBotCallbackAnswer.messagesBotCallbackAnswer,
- 'updateBotCallbackQuery': Update.updateBotCallbackQuery,
'messages.messageEditData': MessagesMessageEditData.messagesMessageEditData,
- 'updateEditMessage': Update.updateEditMessage,
- 'inputBotInlineMessageMediaGeo': InputBotInlineMessage.inputBotInlineMessageMediaGeo,
- 'inputBotInlineMessageMediaVenue': InputBotInlineMessage.inputBotInlineMessageMediaVenue,
- 'inputBotInlineMessageMediaContact': InputBotInlineMessage.inputBotInlineMessageMediaContact,
- 'botInlineMessageMediaGeo': BotInlineMessage.botInlineMessageMediaGeo,
- 'botInlineMessageMediaVenue': BotInlineMessage.botInlineMessageMediaVenue,
- 'botInlineMessageMediaContact': BotInlineMessage.botInlineMessageMediaContact,
- 'inputBotInlineResultPhoto': InputBotInlineResult.inputBotInlineResultPhoto,
- 'inputBotInlineResultDocument': InputBotInlineResult.inputBotInlineResultDocument,
- 'botInlineMediaResult': BotInlineResult.botInlineMediaResult,
'inputBotInlineMessageID': InputBotInlineMessageID.inputBotInlineMessageID,
- 'updateInlineBotCallbackQuery': Update.updateInlineBotCallbackQuery,
+ 'inputBotInlineMessageID64': InputBotInlineMessageID.inputBotInlineMessageID64,
'inlineBotSwitchPM': InlineBotSwitchPM.inlineBotSwitchPM,
'messages.peerDialogs': MessagesPeerDialogs.messagesPeerDialogs,
'topPeer': TopPeer.topPeer,
@@ -9297,50 +9586,32 @@ export interface ConstructorDeclMap {
'topPeerCategoryCorrespondents': TopPeerCategory.topPeerCategoryCorrespondents,
'topPeerCategoryGroups': TopPeerCategory.topPeerCategoryGroups,
'topPeerCategoryChannels': TopPeerCategory.topPeerCategoryChannels,
+ 'topPeerCategoryPhoneCalls': TopPeerCategory.topPeerCategoryPhoneCalls,
+ 'topPeerCategoryForwardUsers': TopPeerCategory.topPeerCategoryForwardUsers,
+ 'topPeerCategoryForwardChats': TopPeerCategory.topPeerCategoryForwardChats,
'topPeerCategoryPeers': TopPeerCategoryPeers.topPeerCategoryPeers,
'contacts.topPeersNotModified': ContactsTopPeers.contactsTopPeersNotModified,
'contacts.topPeers': ContactsTopPeers.contactsTopPeers,
- 'messageEntityMentionName': MessageEntity.messageEntityMentionName,
- 'inputMessageEntityMentionName': MessageEntity.inputMessageEntityMentionName,
- 'inputMessagesFilterChatPhotos': MessagesFilter.inputMessagesFilterChatPhotos,
- 'updateReadChannelOutbox': Update.updateReadChannelOutbox,
- 'updateDraftMessage': Update.updateDraftMessage,
+ 'contacts.topPeersDisabled': ContactsTopPeers.contactsTopPeersDisabled,
'draftMessageEmpty': DraftMessage.draftMessageEmpty,
'draftMessage': DraftMessage.draftMessage,
- 'messageActionHistoryClear': MessageAction.messageActionHistoryClear,
'messages.featuredStickersNotModified': MessagesFeaturedStickers.messagesFeaturedStickersNotModified,
'messages.featuredStickers': MessagesFeaturedStickers.messagesFeaturedStickers,
- 'updateReadFeaturedStickers': Update.updateReadFeaturedStickers,
'messages.recentStickersNotModified': MessagesRecentStickers.messagesRecentStickersNotModified,
'messages.recentStickers': MessagesRecentStickers.messagesRecentStickers,
- 'updateRecentStickers': Update.updateRecentStickers,
'messages.archivedStickers': MessagesArchivedStickers.messagesArchivedStickers,
'messages.stickerSetInstallResultSuccess': MessagesStickerSetInstallResult.messagesStickerSetInstallResultSuccess,
'messages.stickerSetInstallResultArchive': MessagesStickerSetInstallResult.messagesStickerSetInstallResultArchive,
'stickerSetCovered': StickerSetCovered.stickerSetCovered,
- 'updateConfig': Update.updateConfig,
- 'updatePtsChanged': Update.updatePtsChanged,
- 'inputMediaPhotoExternal': InputMedia.inputMediaPhotoExternal,
- 'inputMediaDocumentExternal': InputMedia.inputMediaDocumentExternal,
'stickerSetMultiCovered': StickerSetCovered.stickerSetMultiCovered,
'maskCoords': MaskCoords.maskCoords,
- 'documentAttributeHasStickers': DocumentAttribute.documentAttributeHasStickers,
'inputStickeredMediaPhoto': InputStickeredMedia.inputStickeredMediaPhoto,
'inputStickeredMediaDocument': InputStickeredMedia.inputStickeredMediaDocument,
'game': Game.game,
- 'inputBotInlineResultGame': InputBotInlineResult.inputBotInlineResultGame,
- 'inputBotInlineMessageGame': InputBotInlineMessage.inputBotInlineMessageGame,
- 'messageMediaGame': MessageMedia.messageMediaGame,
- 'inputMediaGame': InputMedia.inputMediaGame,
'inputGameID': InputGame.inputGameID,
'inputGameShortName': InputGame.inputGameShortName,
- 'keyboardButtonGame': KeyboardButton.keyboardButtonGame,
- 'messageActionGameScore': MessageAction.messageActionGameScore,
'highScore': HighScore.highScore,
'messages.highScores': MessagesHighScores.messagesHighScores,
- 'updates.differenceTooLong': UpdatesDifference.updatesDifferenceTooLong,
- 'updateChannelWebPage': Update.updateChannelWebPage,
- 'messages.chatsSlice': MessagesChats.messagesChatsSlice,
'textEmpty': RichText.textEmpty,
'textPlain': RichText.textPlain,
'textBold': RichText.textBold,
@@ -9351,6 +9622,12 @@ export interface ConstructorDeclMap {
'textUrl': RichText.textUrl,
'textEmail': RichText.textEmail,
'textConcat': RichText.textConcat,
+ 'textSubscript': RichText.textSubscript,
+ 'textSuperscript': RichText.textSuperscript,
+ 'textMarked': RichText.textMarked,
+ 'textPhone': RichText.textPhone,
+ 'textImage': RichText.textImage,
+ 'textAnchor': RichText.textAnchor,
'pageBlockUnsupported': PageBlock.pageBlockUnsupported,
'pageBlockTitle': PageBlock.pageBlockTitle,
'pageBlockSubtitle': PageBlock.pageBlockSubtitle,
@@ -9372,47 +9649,44 @@ export interface ConstructorDeclMap {
'pageBlockEmbedPost': PageBlock.pageBlockEmbedPost,
'pageBlockCollage': PageBlock.pageBlockCollage,
'pageBlockSlideshow': PageBlock.pageBlockSlideshow,
- 'webPageNotModified': WebPage.webPageNotModified,
- 'inputPrivacyKeyPhoneCall': InputPrivacyKey.inputPrivacyKeyPhoneCall,
- 'privacyKeyPhoneCall': PrivacyKey.privacyKeyPhoneCall,
- 'sendMessageGamePlayAction': SendMessageAction.sendMessageGamePlayAction,
+ 'pageBlockChannel': PageBlock.pageBlockChannel,
+ 'pageBlockAudio': PageBlock.pageBlockAudio,
+ 'pageBlockKicker': PageBlock.pageBlockKicker,
+ 'pageBlockTable': PageBlock.pageBlockTable,
+ 'pageBlockOrderedList': PageBlock.pageBlockOrderedList,
+ 'pageBlockDetails': PageBlock.pageBlockDetails,
+ 'pageBlockRelatedArticles': PageBlock.pageBlockRelatedArticles,
+ 'pageBlockMap': PageBlock.pageBlockMap,
'phoneCallDiscardReasonMissed': PhoneCallDiscardReason.phoneCallDiscardReasonMissed,
'phoneCallDiscardReasonDisconnect': PhoneCallDiscardReason.phoneCallDiscardReasonDisconnect,
'phoneCallDiscardReasonHangup': PhoneCallDiscardReason.phoneCallDiscardReasonHangup,
'phoneCallDiscardReasonBusy': PhoneCallDiscardReason.phoneCallDiscardReasonBusy,
- 'updateDialogPinned': Update.updateDialogPinned,
- 'updatePinnedDialogs': Update.updatePinnedDialogs,
'dataJSON': DataJSON.dataJSON,
- 'updateBotWebhookJSON': Update.updateBotWebhookJSON,
- 'updateBotWebhookJSONQuery': Update.updateBotWebhookJSONQuery,
'labeledPrice': LabeledPrice.labeledPrice,
'invoice': Invoice.invoice,
- 'inputMediaInvoice': InputMedia.inputMediaInvoice,
'paymentCharge': PaymentCharge.paymentCharge,
- 'messageActionPaymentSentMe': MessageAction.messageActionPaymentSentMe,
- 'messageMediaInvoice': MessageMedia.messageMediaInvoice,
'postAddress': PostAddress.postAddress,
'paymentRequestedInfo': PaymentRequestedInfo.paymentRequestedInfo,
- 'keyboardButtonBuy': KeyboardButton.keyboardButtonBuy,
- 'messageActionPaymentSent': MessageAction.messageActionPaymentSent,
'paymentSavedCredentialsCard': PaymentSavedCredentials.paymentSavedCredentialsCard,
'webDocument': WebDocument.webDocument,
+ 'webDocumentNoProxy': WebDocument.webDocumentNoProxy,
'inputWebDocument': InputWebDocument.inputWebDocument,
'inputWebFileLocation': InputWebFileLocation.inputWebFileLocation,
+ 'inputWebFileGeoPointLocation': InputWebFileLocation.inputWebFileGeoPointLocation,
'upload.webFile': UploadWebFile.uploadWebFile,
'payments.paymentForm': PaymentsPaymentForm.paymentsPaymentForm,
'payments.validatedRequestedInfo': PaymentsValidatedRequestedInfo.paymentsValidatedRequestedInfo,
'payments.paymentResult': PaymentsPaymentResult.paymentsPaymentResult,
+ 'payments.paymentVerificationNeeded': PaymentsPaymentResult.paymentsPaymentVerificationNeeded,
'payments.paymentReceipt': PaymentsPaymentReceipt.paymentsPaymentReceipt,
'payments.savedInfo': PaymentsSavedInfo.paymentsSavedInfo,
'inputPaymentCredentialsSaved': InputPaymentCredentials.inputPaymentCredentialsSaved,
'inputPaymentCredentials': InputPaymentCredentials.inputPaymentCredentials,
+ 'inputPaymentCredentialsApplePay': InputPaymentCredentials.inputPaymentCredentialsApplePay,
+ 'inputPaymentCredentialsGooglePay': InputPaymentCredentials.inputPaymentCredentialsGooglePay,
'account.tmpPassword': AccountTmpPassword.accountTmpPassword,
'shippingOption': ShippingOption.shippingOption,
- 'updateBotShippingQuery': Update.updateBotShippingQuery,
- 'updateBotPrecheckoutQuery': Update.updateBotPrecheckoutQuery,
'inputStickerSetItem': InputStickerSetItem.inputStickerSetItem,
- 'updatePhoneCall': Update.updatePhoneCall,
'inputPhoneCall': InputPhoneCall.inputPhoneCall,
'phoneCallEmpty': PhoneCall.phoneCallEmpty,
'phoneCallWaiting': PhoneCall.phoneCallWaiting,
@@ -9421,31 +9695,18 @@ export interface ConstructorDeclMap {
'phoneCall': PhoneCall.phoneCall,
'phoneCallDiscarded': PhoneCall.phoneCallDiscarded,
'phoneConnection': PhoneConnection.phoneConnection,
+ 'phoneConnectionWebrtc': PhoneConnection.phoneConnectionWebrtc,
'phoneCallProtocol': PhoneCallProtocol.phoneCallProtocol,
'phone.phoneCall': PhonePhoneCall.phonePhoneCall,
- 'inputMessagesFilterPhoneCalls': MessagesFilter.inputMessagesFilterPhoneCalls,
- 'messageActionPhoneCall': MessageAction.messageActionPhoneCall,
- 'inputMessagesFilterRoundVoice': MessagesFilter.inputMessagesFilterRoundVoice,
- 'inputMessagesFilterRoundVideo': MessagesFilter.inputMessagesFilterRoundVideo,
- 'sendMessageRecordRoundAction': SendMessageAction.sendMessageRecordRoundAction,
- 'sendMessageUploadRoundAction': SendMessageAction.sendMessageUploadRoundAction,
- 'upload.fileCdnRedirect': UploadFile.uploadFileCdnRedirect,
'upload.cdnFileReuploadNeeded': UploadCdnFile.uploadCdnFileReuploadNeeded,
'upload.cdnFile': UploadCdnFile.uploadCdnFile,
'cdnPublicKey': CdnPublicKey.cdnPublicKey,
'cdnConfig': CdnConfig.cdnConfig,
- 'pageBlockChannel': PageBlock.pageBlockChannel,
'langPackString': LangPackString.langPackString,
'langPackStringPluralized': LangPackString.langPackStringPluralized,
'langPackStringDeleted': LangPackString.langPackStringDeleted,
'langPackDifference': LangPackDifference.langPackDifference,
'langPackLanguage': LangPackLanguage.langPackLanguage,
- 'updateLangPackTooLong': Update.updateLangPackTooLong,
- 'updateLangPack': Update.updateLangPack,
- 'channelParticipantAdmin': ChannelParticipant.channelParticipantAdmin,
- 'channelParticipantBanned': ChannelParticipant.channelParticipantBanned,
- 'channelParticipantsBanned': ChannelParticipantsFilter.channelParticipantsBanned,
- 'channelParticipantsSearch': ChannelParticipantsFilter.channelParticipantsSearch,
'channelAdminLogEventActionChangeTitle': ChannelAdminLogEventAction.channelAdminLogEventActionChangeTitle,
'channelAdminLogEventActionChangeAbout': ChannelAdminLogEventAction.channelAdminLogEventActionChangeAbout,
'channelAdminLogEventActionChangeUsername': ChannelAdminLogEventAction.channelAdminLogEventActionChangeUsername,
@@ -9460,57 +9721,56 @@ export interface ConstructorDeclMap {
'channelAdminLogEventActionParticipantInvite': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantInvite,
'channelAdminLogEventActionParticipantToggleBan': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleBan,
'channelAdminLogEventActionParticipantToggleAdmin': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantToggleAdmin,
+ 'channelAdminLogEventActionChangeStickerSet': ChannelAdminLogEventAction.channelAdminLogEventActionChangeStickerSet,
+ 'channelAdminLogEventActionTogglePreHistoryHidden': ChannelAdminLogEventAction.channelAdminLogEventActionTogglePreHistoryHidden,
+ 'channelAdminLogEventActionDefaultBannedRights': ChannelAdminLogEventAction.channelAdminLogEventActionDefaultBannedRights,
+ 'channelAdminLogEventActionStopPoll': ChannelAdminLogEventAction.channelAdminLogEventActionStopPoll,
+ 'channelAdminLogEventActionChangeLinkedChat': ChannelAdminLogEventAction.channelAdminLogEventActionChangeLinkedChat,
+ 'channelAdminLogEventActionChangeLocation': ChannelAdminLogEventAction.channelAdminLogEventActionChangeLocation,
+ 'channelAdminLogEventActionToggleSlowMode': ChannelAdminLogEventAction.channelAdminLogEventActionToggleSlowMode,
+ 'channelAdminLogEventActionStartGroupCall': ChannelAdminLogEventAction.channelAdminLogEventActionStartGroupCall,
+ 'channelAdminLogEventActionDiscardGroupCall': ChannelAdminLogEventAction.channelAdminLogEventActionDiscardGroupCall,
+ 'channelAdminLogEventActionParticipantMute': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantMute,
+ 'channelAdminLogEventActionParticipantUnmute': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantUnmute,
+ 'channelAdminLogEventActionToggleGroupCallSetting': ChannelAdminLogEventAction.channelAdminLogEventActionToggleGroupCallSetting,
+ 'channelAdminLogEventActionParticipantJoinByInvite': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByInvite,
+ 'channelAdminLogEventActionExportedInviteDelete': ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteDelete,
+ 'channelAdminLogEventActionExportedInviteRevoke': ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteRevoke,
+ 'channelAdminLogEventActionExportedInviteEdit': ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteEdit,
+ 'channelAdminLogEventActionParticipantVolume': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantVolume,
+ 'channelAdminLogEventActionChangeHistoryTTL': ChannelAdminLogEventAction.channelAdminLogEventActionChangeHistoryTTL,
+ 'channelAdminLogEventActionChangeTheme': ChannelAdminLogEventAction.channelAdminLogEventActionChangeTheme,
'channelAdminLogEvent': ChannelAdminLogEvent.channelAdminLogEvent,
'channels.adminLogResults': ChannelsAdminLogResults.channelsAdminLogResults,
'channelAdminLogEventsFilter': ChannelAdminLogEventsFilter.channelAdminLogEventsFilter,
- 'topPeerCategoryPhoneCalls': TopPeerCategory.topPeerCategoryPhoneCalls,
- 'pageBlockAudio': PageBlock.pageBlockAudio,
'popularContact': PopularContact.popularContact,
- 'messageActionScreenshotTaken': MessageAction.messageActionScreenshotTaken,
'messages.favedStickersNotModified': MessagesFavedStickers.messagesFavedStickersNotModified,
'messages.favedStickers': MessagesFavedStickers.messagesFavedStickers,
- 'updateFavedStickers': Update.updateFavedStickers,
- 'updateChannelReadMessagesContents': Update.updateChannelReadMessagesContents,
- 'inputMessagesFilterMyMentions': MessagesFilter.inputMessagesFilterMyMentions,
- 'updateContactsReset': Update.updateContactsReset,
- 'channelAdminLogEventActionChangeStickerSet': ChannelAdminLogEventAction.channelAdminLogEventActionChangeStickerSet,
- 'messageActionCustomAction': MessageAction.messageActionCustomAction,
- 'inputPaymentCredentialsApplePay': InputPaymentCredentials.inputPaymentCredentialsApplePay,
- 'inputMessagesFilterGeo': MessagesFilter.inputMessagesFilterGeo,
- 'inputMessagesFilterContacts': MessagesFilter.inputMessagesFilterContacts,
- 'updateChannelAvailableMessages': Update.updateChannelAvailableMessages,
- 'channelAdminLogEventActionTogglePreHistoryHidden': ChannelAdminLogEventAction.channelAdminLogEventActionTogglePreHistoryHidden,
- 'inputMediaGeoLive': InputMedia.inputMediaGeoLive,
- 'messageMediaGeoLive': MessageMedia.messageMediaGeoLive,
'recentMeUrlUnknown': RecentMeUrl.recentMeUrlUnknown,
'recentMeUrlUser': RecentMeUrl.recentMeUrlUser,
'recentMeUrlChat': RecentMeUrl.recentMeUrlChat,
'recentMeUrlChatInvite': RecentMeUrl.recentMeUrlChatInvite,
'recentMeUrlStickerSet': RecentMeUrl.recentMeUrlStickerSet,
'help.recentMeUrls': HelpRecentMeUrls.helpRecentMeUrls,
- 'channels.channelParticipantsNotModified': ChannelsChannelParticipants.channelsChannelParticipantsNotModified,
- 'messages.messagesNotModified': MessagesMessages.messagesMessagesNotModified,
'inputSingleMedia': InputSingleMedia.inputSingleMedia,
'webAuthorization': WebAuthorization.webAuthorization,
'account.webAuthorizations': AccountWebAuthorizations.accountWebAuthorizations,
'inputMessageID': InputMessage.inputMessageID,
'inputMessageReplyTo': InputMessage.inputMessageReplyTo,
'inputMessagePinned': InputMessage.inputMessagePinned,
- 'messageEntityPhone': MessageEntity.messageEntityPhone,
- 'messageEntityCashtag': MessageEntity.messageEntityCashtag,
- 'messageActionBotAllowed': MessageAction.messageActionBotAllowed,
+ 'inputMessageCallbackQuery': InputMessage.inputMessageCallbackQuery,
'inputDialogPeer': InputDialogPeer.inputDialogPeer,
+ 'inputDialogPeerFolder': InputDialogPeer.inputDialogPeerFolder,
'dialogPeer': DialogPeer.dialogPeer,
+ 'dialogPeerFolder': DialogPeer.dialogPeerFolder,
'messages.foundStickerSetsNotModified': MessagesFoundStickerSets.messagesFoundStickerSetsNotModified,
'messages.foundStickerSets': MessagesFoundStickerSets.messagesFoundStickerSets,
'fileHash': FileHash.fileHash,
- 'webDocumentNoProxy': WebDocument.webDocumentNoProxy,
'inputClientProxy': InputClientProxy.inputClientProxy,
'help.termsOfServiceUpdateEmpty': HelpTermsOfServiceUpdate.helpTermsOfServiceUpdateEmpty,
'help.termsOfServiceUpdate': HelpTermsOfServiceUpdate.helpTermsOfServiceUpdate,
'inputSecureFileUploaded': InputSecureFile.inputSecureFileUploaded,
'inputSecureFile': InputSecureFile.inputSecureFile,
- 'inputSecureFileLocation': InputFileLocation.inputSecureFileLocation,
'secureFileEmpty': SecureFile.secureFileEmpty,
'secureFile': SecureFile.secureFile,
'secureData': SecureData.secureData,
@@ -9538,32 +9798,24 @@ export interface ConstructorDeclMap {
'secureValueErrorSelfie': SecureValueError.secureValueErrorSelfie,
'secureValueErrorFile': SecureValueError.secureValueErrorFile,
'secureValueErrorFiles': SecureValueError.secureValueErrorFiles,
+ 'secureValueError': SecureValueError.secureValueError,
+ 'secureValueErrorTranslationFile': SecureValueError.secureValueErrorTranslationFile,
+ 'secureValueErrorTranslationFiles': SecureValueError.secureValueErrorTranslationFiles,
'secureCredentialsEncrypted': SecureCredentialsEncrypted.secureCredentialsEncrypted,
'account.authorizationForm': AccountAuthorizationForm.accountAuthorizationForm,
'account.sentEmailCode': AccountSentEmailCode.accountSentEmailCode,
- 'messageActionSecureValuesSentMe': MessageAction.messageActionSecureValuesSentMe,
- 'messageActionSecureValuesSent': MessageAction.messageActionSecureValuesSent,
'help.deepLinkInfoEmpty': HelpDeepLinkInfo.helpDeepLinkInfoEmpty,
'help.deepLinkInfo': HelpDeepLinkInfo.helpDeepLinkInfo,
'savedPhoneContact': SavedContact.savedPhoneContact,
'account.takeout': AccountTakeout.accountTakeout,
- 'inputTakeoutFileLocation': InputFileLocation.inputTakeoutFileLocation,
- 'updateDialogUnreadMark': Update.updateDialogUnreadMark,
- 'messages.dialogsNotModified': MessagesDialogs.messagesDialogsNotModified,
- 'inputWebFileGeoPointLocation': InputWebFileLocation.inputWebFileGeoPointLocation,
- 'contacts.topPeersDisabled': ContactsTopPeers.contactsTopPeersDisabled,
- 'inputReportReasonCopyright': ReportReason.inputReportReasonCopyright,
'passwordKdfAlgoUnknown': PasswordKdfAlgo.passwordKdfAlgoUnknown,
+ 'passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow': PasswordKdfAlgo.passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow,
'securePasswordKdfAlgoUnknown': SecurePasswordKdfAlgo.securePasswordKdfAlgoUnknown,
'securePasswordKdfAlgoPBKDF2HMACSHA512iter100000': SecurePasswordKdfAlgo.securePasswordKdfAlgoPBKDF2HMACSHA512iter100000,
'securePasswordKdfAlgoSHA512': SecurePasswordKdfAlgo.securePasswordKdfAlgoSHA512,
'secureSecretSettings': SecureSecretSettings.secureSecretSettings,
- 'passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow': PasswordKdfAlgo.passwordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow,
'inputCheckPasswordEmpty': InputCheckPasswordSRP.inputCheckPasswordEmpty,
'inputCheckPasswordSRP': InputCheckPasswordSRP.inputCheckPasswordSRP,
- 'secureValueError': SecureValueError.secureValueError,
- 'secureValueErrorTranslationFile': SecureValueError.secureValueErrorTranslationFile,
- 'secureValueErrorTranslationFiles': SecureValueError.secureValueErrorTranslationFiles,
'secureRequiredType': SecureRequiredType.secureRequiredType,
'secureRequiredTypeOneOf': SecureRequiredType.secureRequiredTypeOneOf,
'help.passportConfigNotModified': HelpPassportConfig.helpPassportConfigNotModified,
@@ -9576,53 +9828,29 @@ export interface ConstructorDeclMap {
'jsonString': JSONValue.jsonString,
'jsonArray': JSONValue.jsonArray,
'jsonObject': JSONValue.jsonObject,
- 'inputNotifyBroadcasts': InputNotifyPeer.inputNotifyBroadcasts,
- 'notifyBroadcasts': NotifyPeer.notifyBroadcasts,
- 'textSubscript': RichText.textSubscript,
- 'textSuperscript': RichText.textSuperscript,
- 'textMarked': RichText.textMarked,
- 'textPhone': RichText.textPhone,
- 'textImage': RichText.textImage,
- 'pageBlockKicker': PageBlock.pageBlockKicker,
'pageTableCell': PageTableCell.pageTableCell,
'pageTableRow': PageTableRow.pageTableRow,
- 'pageBlockTable': PageBlock.pageBlockTable,
'pageCaption': PageCaption.pageCaption,
'pageListItemText': PageListItem.pageListItemText,
'pageListItemBlocks': PageListItem.pageListItemBlocks,
'pageListOrderedItemText': PageListOrderedItem.pageListOrderedItemText,
'pageListOrderedItemBlocks': PageListOrderedItem.pageListOrderedItemBlocks,
- 'pageBlockOrderedList': PageBlock.pageBlockOrderedList,
- 'pageBlockDetails': PageBlock.pageBlockDetails,
'pageRelatedArticle': PageRelatedArticle.pageRelatedArticle,
- 'pageBlockRelatedArticles': PageBlock.pageBlockRelatedArticles,
- 'pageBlockMap': PageBlock.pageBlockMap,
'page': Page.page,
- 'inputPrivacyKeyPhoneP2P': InputPrivacyKey.inputPrivacyKeyPhoneP2P,
- 'privacyKeyPhoneP2P': PrivacyKey.privacyKeyPhoneP2P,
- 'textAnchor': RichText.textAnchor,
'help.supportName': HelpSupportName.helpSupportName,
'help.userInfoEmpty': HelpUserInfo.helpUserInfoEmpty,
'help.userInfo': HelpUserInfo.helpUserInfo,
- 'messageActionContactSignUp': MessageAction.messageActionContactSignUp,
- 'updateMessagePoll': Update.updateMessagePoll,
'pollAnswer': PollAnswer.pollAnswer,
'poll': Poll.poll,
'pollAnswerVoters': PollAnswerVoters.pollAnswerVoters,
'pollResults': PollResults.pollResults,
- 'inputMediaPoll': InputMedia.inputMediaPoll,
- 'messageMediaPoll': MessageMedia.messageMediaPoll,
'chatOnlines': ChatOnlines.chatOnlines,
'statsURL': StatsURL.statsURL,
- 'photoStrippedSize': PhotoSize.photoStrippedSize,
'chatAdminRights': ChatAdminRights.chatAdminRights,
'chatBannedRights': ChatBannedRights.chatBannedRights,
- 'updateChatDefaultBannedRights': Update.updateChatDefaultBannedRights,
'inputWallPaper': InputWallPaper.inputWallPaper,
'inputWallPaperSlug': InputWallPaper.inputWallPaperSlug,
- 'channelParticipantsContacts': ChannelParticipantsFilter.channelParticipantsContacts,
- 'channelAdminLogEventActionDefaultBannedRights': ChannelAdminLogEventAction.channelAdminLogEventActionDefaultBannedRights,
- 'channelAdminLogEventActionStopPoll': ChannelAdminLogEventAction.channelAdminLogEventActionStopPoll,
+ 'inputWallPaperNoFile': InputWallPaper.inputWallPaperNoFile,
'account.wallPapersNotModified': AccountWallPapers.accountWallPapersNotModified,
'account.wallPapers': AccountWallPapers.accountWallPapers,
'codeSettings': CodeSettings.codeSettings,
@@ -9634,67 +9862,23 @@ export interface ConstructorDeclMap {
'emojiKeywordsDifference': EmojiKeywordsDifference.emojiKeywordsDifference,
'emojiURL': EmojiURL.emojiURL,
'emojiLanguage': EmojiLanguage.emojiLanguage,
- 'inputPrivacyKeyForwards': InputPrivacyKey.inputPrivacyKeyForwards,
- 'privacyKeyForwards': PrivacyKey.privacyKeyForwards,
- 'inputPrivacyKeyProfilePhoto': InputPrivacyKey.inputPrivacyKeyProfilePhoto,
- 'privacyKeyProfilePhoto': PrivacyKey.privacyKeyProfilePhoto,
- 'inputPhotoFileLocation': InputFileLocation.inputPhotoFileLocation,
- 'inputPhotoLegacyFileLocation': InputFileLocation.inputPhotoLegacyFileLocation,
- 'inputPeerPhotoFileLocation': InputFileLocation.inputPeerPhotoFileLocation,
- 'inputStickerSetThumb': InputFileLocation.inputStickerSetThumb,
'folder': Folder.folder,
- 'dialogFolder': Dialog.dialogFolder,
- 'inputDialogPeerFolder': InputDialogPeer.inputDialogPeerFolder,
- 'dialogPeerFolder': DialogPeer.dialogPeerFolder,
'inputFolderPeer': InputFolderPeer.inputFolderPeer,
'folderPeer': FolderPeer.folderPeer,
- 'updateFolderPeers': Update.updateFolderPeers,
- 'inputUserFromMessage': InputUser.inputUserFromMessage,
- 'inputChannelFromMessage': InputChannel.inputChannelFromMessage,
- 'inputPeerUserFromMessage': InputPeer.inputPeerUserFromMessage,
- 'inputPeerChannelFromMessage': InputPeer.inputPeerChannelFromMessage,
- 'inputPrivacyKeyPhoneNumber': InputPrivacyKey.inputPrivacyKeyPhoneNumber,
- 'privacyKeyPhoneNumber': PrivacyKey.privacyKeyPhoneNumber,
- 'topPeerCategoryForwardUsers': TopPeerCategory.topPeerCategoryForwardUsers,
- 'topPeerCategoryForwardChats': TopPeerCategory.topPeerCategoryForwardChats,
- 'channelAdminLogEventActionChangeLinkedChat': ChannelAdminLogEventAction.channelAdminLogEventActionChangeLinkedChat,
'messages.searchCounter': MessagesSearchCounter.messagesSearchCounter,
- 'keyboardButtonUrlAuth': KeyboardButton.keyboardButtonUrlAuth,
- 'inputKeyboardButtonUrlAuth': KeyboardButton.inputKeyboardButtonUrlAuth,
'urlAuthResultRequest': UrlAuthResult.urlAuthResultRequest,
'urlAuthResultAccepted': UrlAuthResult.urlAuthResultAccepted,
'urlAuthResultDefault': UrlAuthResult.urlAuthResultDefault,
- 'inputPrivacyValueAllowChatParticipants': InputPrivacyRule.inputPrivacyValueAllowChatParticipants,
- 'inputPrivacyValueDisallowChatParticipants': InputPrivacyRule.inputPrivacyValueDisallowChatParticipants,
- 'privacyValueAllowChatParticipants': PrivacyRule.privacyValueAllowChatParticipants,
- 'privacyValueDisallowChatParticipants': PrivacyRule.privacyValueDisallowChatParticipants,
- 'messageEntityUnderline': MessageEntity.messageEntityUnderline,
- 'messageEntityStrike': MessageEntity.messageEntityStrike,
- 'messageEntityBlockquote': MessageEntity.messageEntityBlockquote,
- 'updatePeerSettings': Update.updatePeerSettings,
'channelLocationEmpty': ChannelLocation.channelLocationEmpty,
'channelLocation': ChannelLocation.channelLocation,
'peerLocated': PeerLocated.peerLocated,
- 'updatePeerLocated': Update.updatePeerLocated,
- 'channelAdminLogEventActionChangeLocation': ChannelAdminLogEventAction.channelAdminLogEventActionChangeLocation,
- 'inputReportReasonGeoIrrelevant': ReportReason.inputReportReasonGeoIrrelevant,
- 'channelAdminLogEventActionToggleSlowMode': ChannelAdminLogEventAction.channelAdminLogEventActionToggleSlowMode,
- 'auth.authorizationSignUpRequired': AuthAuthorization.authAuthorizationSignUpRequired,
- 'payments.paymentVerificationNeeded': PaymentsPaymentResult.paymentsPaymentVerificationNeeded,
- 'inputStickerSetAnimatedEmoji': InputStickerSet.inputStickerSetAnimatedEmoji,
- 'updateNewScheduledMessage': Update.updateNewScheduledMessage,
- 'updateDeleteScheduledMessages': Update.updateDeleteScheduledMessages,
+ 'peerSelfLocated': PeerLocated.peerSelfLocated,
'restrictionReason': RestrictionReason.restrictionReason,
'inputTheme': InputTheme.inputTheme,
'inputThemeSlug': InputTheme.inputThemeSlug,
'theme': Theme.theme,
'account.themesNotModified': AccountThemes.accountThemesNotModified,
'account.themes': AccountThemes.accountThemes,
- 'updateTheme': Update.updateTheme,
- 'inputPrivacyKeyAddedByPhone': InputPrivacyKey.inputPrivacyKeyAddedByPhone,
- 'privacyKeyAddedByPhone': PrivacyKey.privacyKeyAddedByPhone,
- 'updateGeoLiveViewed': Update.updateGeoLiveViewed,
- 'updateLoginToken': Update.updateLoginToken,
'auth.loginToken': AuthLoginToken.authLoginToken,
'auth.loginTokenMigrateTo': AuthLoginToken.authLoginTokenMigrateTo,
'auth.loginTokenSuccess': AuthLoginToken.authLoginTokenSuccess,
@@ -9705,26 +9889,17 @@ export interface ConstructorDeclMap {
'baseThemeNight': BaseTheme.baseThemeNight,
'baseThemeTinted': BaseTheme.baseThemeTinted,
'baseThemeArctic': BaseTheme.baseThemeArctic,
- 'inputWallPaperNoFile': InputWallPaper.inputWallPaperNoFile,
- 'wallPaperNoFile': WallPaper.wallPaperNoFile,
'inputThemeSettings': InputThemeSettings.inputThemeSettings,
'themeSettings': ThemeSettings.themeSettings,
'webPageAttributeTheme': WebPageAttribute.webPageAttributeTheme,
- 'updateMessagePollVote': Update.updateMessagePollVote,
'messageUserVote': MessageUserVote.messageUserVote,
'messageUserVoteInputOption': MessageUserVote.messageUserVoteInputOption,
'messageUserVoteMultiple': MessageUserVote.messageUserVoteMultiple,
'messages.votesList': MessagesVotesList.messagesVotesList,
- 'keyboardButtonRequestPoll': KeyboardButton.keyboardButtonRequestPoll,
- 'messageEntityBankCard': MessageEntity.messageEntityBankCard,
'bankCardOpenUrl': BankCardOpenUrl.bankCardOpenUrl,
'payments.bankCardData': PaymentsBankCardData.paymentsBankCardData,
- 'peerSelfLocated': PeerLocated.peerSelfLocated,
'dialogFilter': DialogFilter.dialogFilter,
'dialogFilterSuggested': DialogFilterSuggested.dialogFilterSuggested,
- 'updateDialogFilter': Update.updateDialogFilter,
- 'updateDialogFilterOrder': Update.updateDialogFilterOrder,
- 'updateDialogFilters': Update.updateDialogFilters,
'statsDateRangeDays': StatsDateRangeDays.statsDateRangeDays,
'statsAbsValueAndPrev': StatsAbsValueAndPrev.statsAbsValueAndPrev,
'statsPercentValue': StatsPercentValue.statsPercentValue,
@@ -9733,55 +9908,29 @@ export interface ConstructorDeclMap {
'statsGraph': StatsGraph.statsGraph,
'messageInteractionCounters': MessageInteractionCounters.messageInteractionCounters,
'stats.broadcastStats': StatsBroadcastStats.statsBroadcastStats,
- 'inputMediaDice': InputMedia.inputMediaDice,
- 'messageMediaDice': MessageMedia.messageMediaDice,
- 'inputStickerSetDice': InputStickerSet.inputStickerSetDice,
'help.promoDataEmpty': HelpPromoData.helpPromoDataEmpty,
'help.promoData': HelpPromoData.helpPromoData,
'videoSize': VideoSize.videoSize,
- 'updatePhoneCallSignalingData': Update.updatePhoneCallSignalingData,
- 'chatInvitePeek': ChatInvite.chatInvitePeek,
'statsGroupTopPoster': StatsGroupTopPoster.statsGroupTopPoster,
'statsGroupTopAdmin': StatsGroupTopAdmin.statsGroupTopAdmin,
'statsGroupTopInviter': StatsGroupTopInviter.statsGroupTopInviter,
'stats.megagroupStats': StatsMegagroupStats.statsMegagroupStats,
'globalPrivacySettings': GlobalPrivacySettings.globalPrivacySettings,
- 'phoneConnectionWebrtc': PhoneConnection.phoneConnectionWebrtc,
'help.countryCode': HelpCountryCode.helpCountryCode,
'help.country': HelpCountry.helpCountry,
'help.countriesListNotModified': HelpCountriesList.helpCountriesListNotModified,
'help.countriesList': HelpCountriesList.helpCountriesList,
'messageViews': MessageViews.messageViews,
- 'updateChannelMessageForwards': Update.updateChannelMessageForwards,
- 'photoSizeProgressive': PhotoSize.photoSizeProgressive,
'messages.messageViews': MessagesMessageViews.messagesMessageViews,
- 'updateReadChannelDiscussionInbox': Update.updateReadChannelDiscussionInbox,
- 'updateReadChannelDiscussionOutbox': Update.updateReadChannelDiscussionOutbox,
'messages.discussionMessage': MessagesDiscussionMessage.messagesDiscussionMessage,
'messageReplyHeader': MessageReplyHeader.messageReplyHeader,
'messageReplies': MessageReplies.messageReplies,
- 'updatePeerBlocked': Update.updatePeerBlocked,
'peerBlocked': PeerBlocked.peerBlocked,
- 'updateChannelUserTyping': Update.updateChannelUserTyping,
- 'inputMessageCallbackQuery': InputMessage.inputMessageCallbackQuery,
- 'channelParticipantLeft': ChannelParticipant.channelParticipantLeft,
- 'channelParticipantsMentions': ChannelParticipantsFilter.channelParticipantsMentions,
- 'updatePinnedMessages': Update.updatePinnedMessages,
- 'updatePinnedChannelMessages': Update.updatePinnedChannelMessages,
- 'inputMessagesFilterPinned': MessagesFilter.inputMessagesFilterPinned,
'stats.messageStats': StatsMessageStats.statsMessageStats,
- 'messageActionGeoProximityReached': MessageAction.messageActionGeoProximityReached,
- 'photoPathSize': PhotoSize.photoPathSize,
- 'speakingInGroupCallAction': SendMessageAction.speakingInGroupCallAction,
'groupCallDiscarded': GroupCall.groupCallDiscarded,
'groupCall': GroupCall.groupCall,
'inputGroupCall': InputGroupCall.inputGroupCall,
- 'messageActionGroupCall': MessageAction.messageActionGroupCall,
- 'messageActionInviteToGroupCall': MessageAction.messageActionInviteToGroupCall,
'groupCallParticipant': GroupCallParticipant.groupCallParticipant,
- 'updateChat': Update.updateChat,
- 'updateGroupCallParticipants': Update.updateGroupCallParticipants,
- 'updateGroupCall': Update.updateGroupCall,
'phone.groupCall': PhoneGroupCall.phoneGroupCall,
'phone.groupParticipants': PhoneGroupParticipants.phoneGroupParticipants,
'inlineQueryPeerTypeSameBotPM': InlineQueryPeerType.inlineQueryPeerTypeSameBotPM,
@@ -9789,22 +9938,9 @@ export interface ConstructorDeclMap {
'inlineQueryPeerTypeChat': InlineQueryPeerType.inlineQueryPeerTypeChat,
'inlineQueryPeerTypeMegagroup': InlineQueryPeerType.inlineQueryPeerTypeMegagroup,
'inlineQueryPeerTypeBroadcast': InlineQueryPeerType.inlineQueryPeerTypeBroadcast,
- 'channelAdminLogEventActionStartGroupCall': ChannelAdminLogEventAction.channelAdminLogEventActionStartGroupCall,
- 'channelAdminLogEventActionDiscardGroupCall': ChannelAdminLogEventAction.channelAdminLogEventActionDiscardGroupCall,
- 'channelAdminLogEventActionParticipantMute': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantMute,
- 'channelAdminLogEventActionParticipantUnmute': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantUnmute,
- 'channelAdminLogEventActionToggleGroupCallSetting': ChannelAdminLogEventAction.channelAdminLogEventActionToggleGroupCallSetting,
- 'inputPaymentCredentialsGooglePay': InputPaymentCredentials.inputPaymentCredentialsGooglePay,
'messages.historyImport': MessagesHistoryImport.messagesHistoryImport,
- 'sendMessageHistoryImportAction': SendMessageAction.sendMessageHistoryImportAction,
'messages.historyImportParsed': MessagesHistoryImportParsed.messagesHistoryImportParsed,
- 'inputReportReasonFake': ReportReason.inputReportReasonFake,
'messages.affectedFoundMessages': MessagesAffectedFoundMessages.messagesAffectedFoundMessages,
- 'messageActionSetMessagesTTL': MessageAction.messageActionSetMessagesTTL,
- 'updatePeerHistoryTTL': Update.updatePeerHistoryTTL,
- 'updateChatParticipant': Update.updateChatParticipant,
- 'updateChannelParticipant': Update.updateChannelParticipant,
- 'updateBotStopped': Update.updateBotStopped,
'chatInviteImporter': ChatInviteImporter.chatInviteImporter,
'messages.exportedChatInvites': MessagesExportedChatInvites.messagesExportedChatInvites,
'messages.exportedChatInvite': MessagesExportedChatInvite.messagesExportedChatInvite,
@@ -9812,22 +9948,11 @@ export interface ConstructorDeclMap {
'messages.chatInviteImporters': MessagesChatInviteImporters.messagesChatInviteImporters,
'chatAdminWithInvites': ChatAdminWithInvites.chatAdminWithInvites,
'messages.chatAdminsWithInvites': MessagesChatAdminsWithInvites.messagesChatAdminsWithInvites,
- 'channelAdminLogEventActionParticipantJoinByInvite': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantJoinByInvite,
- 'channelAdminLogEventActionExportedInviteDelete': ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteDelete,
- 'channelAdminLogEventActionExportedInviteRevoke': ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteRevoke,
- 'channelAdminLogEventActionExportedInviteEdit': ChannelAdminLogEventAction.channelAdminLogEventActionExportedInviteEdit,
- 'channelAdminLogEventActionParticipantVolume': ChannelAdminLogEventAction.channelAdminLogEventActionParticipantVolume,
- 'channelAdminLogEventActionChangeHistoryTTL': ChannelAdminLogEventAction.channelAdminLogEventActionChangeHistoryTTL,
'messages.checkedHistoryImportPeer': MessagesCheckedHistoryImportPeer.messagesCheckedHistoryImportPeer,
- 'inputGroupCallStream': InputFileLocation.inputGroupCallStream,
'phone.joinAsPeers': PhoneJoinAsPeers.phoneJoinAsPeers,
'phone.exportedGroupCallInvite': PhoneExportedGroupCallInvite.phoneExportedGroupCallInvite,
- 'inputBotInlineMessageMediaInvoice': InputBotInlineMessage.inputBotInlineMessageMediaInvoice,
- 'botInlineMessageMediaInvoice': BotInlineMessage.botInlineMessageMediaInvoice,
- 'messageActionGroupCallScheduled': MessageAction.messageActionGroupCallScheduled,
'groupCallParticipantVideoSourceGroup': GroupCallParticipantVideoSourceGroup.groupCallParticipantVideoSourceGroup,
'groupCallParticipantVideo': GroupCallParticipantVideo.groupCallParticipantVideo,
- 'updateGroupCallConnection': Update.updateGroupCallConnection,
'stickers.suggestedShortName': StickersSuggestedShortName.stickersSuggestedShortName,
'botCommandScopeDefault': BotCommandScope.botCommandScopeDefault,
'botCommandScopeUsers': BotCommandScope.botCommandScopeUsers,
@@ -9839,7 +9964,11 @@ export interface ConstructorDeclMap {
'account.resetPasswordFailedWait': AccountResetPasswordResult.accountResetPasswordFailedWait,
'account.resetPasswordRequestedWait': AccountResetPasswordResult.accountResetPasswordRequestedWait,
'account.resetPasswordOk': AccountResetPasswordResult.accountResetPasswordOk,
- 'updateBotCommands': Update.updateBotCommands,
+ 'chatTheme': ChatTheme.chatTheme,
+ 'account.chatThemesNotModified': AccountChatThemes.accountChatThemesNotModified,
+ 'account.chatThemes': AccountChatThemes.accountChatThemes,
+ 'sponsoredMessage': SponsoredMessage.sponsoredMessage,
+ 'messages.sponsoredMessages': MessagesSponsoredMessages.messagesSponsoredMessages,
'messageEntityEmoji': MessageEntity.messageEntityEmoji,
'messageEntityHighlight': MessageEntity.messageEntityHighlight,
'messageEntityLinebreak': MessageEntity.messageEntityLinebreak,
@@ -9862,12 +9991,45 @@ export interface ConstructorDeclMap {
}
export type InvokeAfterMsg = {
- msg_id: string,
+ msg_id: string | number,
query: any
};
export type InvokeAfterMsgs = {
- msg_ids: Array,
+ msg_ids: Array,
+ query: any
+};
+
+export type InitConnection = {
+ flags?: number,
+ api_id: number,
+ device_model: string,
+ system_version: string,
+ app_version: string,
+ system_lang_code: string,
+ lang_pack: string,
+ lang_code: string,
+ proxy?: InputClientProxy,
+ params?: JSONValue,
+ query: any
+};
+
+export type InvokeWithLayer = {
+ layer: number,
+ query: any
+};
+
+export type InvokeWithoutUpdates = {
+ query: any
+};
+
+export type InvokeWithMessagesRange = {
+ range: MessageRange,
+ query: any
+};
+
+export type InvokeWithTakeout = {
+ takeout_id: string | number,
query: any
};
@@ -9904,17 +10066,70 @@ export type AuthExportAuthorization = {
};
export type AuthImportAuthorization = {
- id: number,
+ id: string | number,
bytes: Uint8Array
};
export type AuthBindTempAuthKey = {
- perm_auth_key_id: string,
- nonce: string,
+ perm_auth_key_id: string | number,
+ nonce: string | number,
expires_at: number,
encrypted_message: Uint8Array
};
+export type AuthImportBotAuthorization = {
+ flags?: number,
+ api_id: number,
+ api_hash: string,
+ bot_auth_token: string
+};
+
+export type AuthCheckPassword = {
+ password: InputCheckPasswordSRP
+};
+
+export type AuthRequestPasswordRecovery = {
+
+};
+
+export type AuthRecoverPassword = {
+ flags?: number,
+ code: string,
+ new_settings?: AccountPasswordInputSettings
+};
+
+export type AuthResendCode = {
+ phone_number: string,
+ phone_code_hash: string
+};
+
+export type AuthCancelCode = {
+ phone_number: string,
+ phone_code_hash: string
+};
+
+export type AuthDropTempAuthKeys = {
+ except_auth_keys: Array
+};
+
+export type AuthExportLoginToken = {
+ api_id: number,
+ api_hash: string,
+ except_ids: Array
+};
+
+export type AuthImportLoginToken = {
+ token: Uint8Array
+};
+
+export type AuthAcceptLoginToken = {
+ token: Uint8Array
+};
+
+export type AuthCheckRecoveryPassword = {
+ code: string
+};
+
export type AccountRegisterDevice = {
flags?: number,
no_muted?: boolean,
@@ -9922,13 +10137,13 @@ export type AccountRegisterDevice = {
token: string,
app_sandbox: boolean,
secret: Uint8Array,
- other_uids: Array
+ other_uids: Array
};
export type AccountUnregisterDevice = {
token_type: number,
token: string,
- other_uids: Array
+ other_uids: Array
};
export type AccountUpdateNotifySettings = {
@@ -9956,7 +10171,7 @@ export type AccountUpdateStatus = {
};
export type AccountGetWallPapers = {
- hash: number
+ hash: string | number
};
export type AccountReportPeer = {
@@ -9965,6 +10180,316 @@ export type AccountReportPeer = {
message: string
};
+export type AccountCheckUsername = {
+ username: string
+};
+
+export type AccountUpdateUsername = {
+ username: string
+};
+
+export type AccountGetPrivacy = {
+ key: InputPrivacyKey
+};
+
+export type AccountSetPrivacy = {
+ key: InputPrivacyKey,
+ rules: Array
+};
+
+export type AccountDeleteAccount = {
+ reason: string
+};
+
+export type AccountGetAccountTTL = {
+
+};
+
+export type AccountSetAccountTTL = {
+ ttl: AccountDaysTTL
+};
+
+export type AccountSendChangePhoneCode = {
+ phone_number: string,
+ settings: CodeSettings
+};
+
+export type AccountChangePhone = {
+ phone_number: string,
+ phone_code_hash: string,
+ phone_code: string
+};
+
+export type AccountUpdateDeviceLocked = {
+ period: number
+};
+
+export type AccountGetAuthorizations = {
+
+};
+
+export type AccountResetAuthorization = {
+ hash: string | number
+};
+
+export type AccountGetPassword = {
+
+};
+
+export type AccountGetPasswordSettings = {
+ password: InputCheckPasswordSRP
+};
+
+export type AccountUpdatePasswordSettings = {
+ password: InputCheckPasswordSRP,
+ new_settings: AccountPasswordInputSettings
+};
+
+export type AccountSendConfirmPhoneCode = {
+ hash: string,
+ settings: CodeSettings
+};
+
+export type AccountConfirmPhone = {
+ phone_code_hash: string,
+ phone_code: string
+};
+
+export type AccountGetTmpPassword = {
+ password: InputCheckPasswordSRP,
+ period: number
+};
+
+export type AccountGetWebAuthorizations = {
+
+};
+
+export type AccountResetWebAuthorization = {
+ hash: string | number
+};
+
+export type AccountResetWebAuthorizations = {
+
+};
+
+export type AccountGetAllSecureValues = {
+
+};
+
+export type AccountGetSecureValue = {
+ types: Array
+};
+
+export type AccountSaveSecureValue = {
+ value: InputSecureValue,
+ secure_secret_id: string | number
+};
+
+export type AccountDeleteSecureValue = {
+ types: Array
+};
+
+export type AccountGetAuthorizationForm = {
+ bot_id: string | number,
+ scope: string,
+ public_key: string
+};
+
+export type AccountAcceptAuthorization = {
+ bot_id: string | number,
+ scope: string,
+ public_key: string,
+ value_hashes: Array,
+ credentials: SecureCredentialsEncrypted
+};
+
+export type AccountSendVerifyPhoneCode = {
+ phone_number: string,
+ settings: CodeSettings
+};
+
+export type AccountVerifyPhone = {
+ phone_number: string,
+ phone_code_hash: string,
+ phone_code: string
+};
+
+export type AccountSendVerifyEmailCode = {
+ email: string
+};
+
+export type AccountVerifyEmail = {
+ email: string,
+ code: string
+};
+
+export type AccountInitTakeoutSession = {
+ flags?: number,
+ contacts?: boolean,
+ message_users?: boolean,
+ message_chats?: boolean,
+ message_megagroups?: boolean,
+ message_channels?: boolean,
+ files?: boolean,
+ file_max_size?: number
+};
+
+export type AccountFinishTakeoutSession = {
+ flags?: number,
+ success?: boolean
+};
+
+export type AccountConfirmPasswordEmail = {
+ code: string
+};
+
+export type AccountResendPasswordEmail = {
+
+};
+
+export type AccountCancelPasswordEmail = {
+
+};
+
+export type AccountGetContactSignUpNotification = {
+
+};
+
+export type AccountSetContactSignUpNotification = {
+ silent: boolean
+};
+
+export type AccountGetNotifyExceptions = {
+ flags?: number,
+ compare_sound?: boolean,
+ peer?: InputNotifyPeer
+};
+
+export type AccountGetWallPaper = {
+ wallpaper: InputWallPaper
+};
+
+export type AccountUploadWallPaper = {
+ file: InputFile,
+ mime_type: string,
+ settings: WallPaperSettings
+};
+
+export type AccountSaveWallPaper = {
+ wallpaper: InputWallPaper,
+ unsave: boolean,
+ settings: WallPaperSettings
+};
+
+export type AccountInstallWallPaper = {
+ wallpaper: InputWallPaper,
+ settings: WallPaperSettings
+};
+
+export type AccountResetWallPapers = {
+
+};
+
+export type AccountGetAutoDownloadSettings = {
+
+};
+
+export type AccountSaveAutoDownloadSettings = {
+ flags?: number,
+ low?: boolean,
+ high?: boolean,
+ settings: AutoDownloadSettings
+};
+
+export type AccountUploadTheme = {
+ flags?: number,
+ file: InputFile,
+ thumb?: InputFile,
+ file_name: string,
+ mime_type: string
+};
+
+export type AccountCreateTheme = {
+ flags?: number,
+ slug: string,
+ title: string,
+ document?: InputDocument,
+ settings?: InputThemeSettings
+};
+
+export type AccountUpdateTheme = {
+ flags?: number,
+ format: string,
+ theme: InputTheme,
+ slug?: string,
+ title?: string,
+ document?: InputDocument,
+ settings?: InputThemeSettings
+};
+
+export type AccountSaveTheme = {
+ theme: InputTheme,
+ unsave: boolean
+};
+
+export type AccountInstallTheme = {
+ flags?: number,
+ dark?: boolean,
+ format?: string,
+ theme?: InputTheme
+};
+
+export type AccountGetTheme = {
+ format: string,
+ theme: InputTheme,
+ document_id: string | number
+};
+
+export type AccountGetThemes = {
+ format: string,
+ hash: string | number
+};
+
+export type AccountSetContentSettings = {
+ flags?: number,
+ sensitive_enabled?: boolean
+};
+
+export type AccountGetContentSettings = {
+
+};
+
+export type AccountGetMultiWallPapers = {
+ wallpapers: Array
+};
+
+export type AccountGetGlobalPrivacySettings = {
+
+};
+
+export type AccountSetGlobalPrivacySettings = {
+ settings: GlobalPrivacySettings
+};
+
+export type AccountReportProfilePhoto = {
+ peer: InputPeer,
+ photo_id: InputPhoto,
+ reason: ReportReason,
+ message: string
+};
+
+export type AccountResetPassword = {
+
+};
+
+export type AccountDeclinePasswordReset = {
+
+};
+
+export type AccountGetChatThemes = {
+ hash: number
+};
+
export type UsersGetUsers = {
id: Array
};
@@ -9973,8 +10498,13 @@ export type UsersGetFullUser = {
id: InputUser
};
+export type UsersSetSecureValueErrors = {
+ id: InputUser,
+ errors: Array
+};
+
export type ContactsGetContactIDs = {
- hash: number
+ hash: string | number
};
export type ContactsGetStatuses = {
@@ -9982,7 +10512,7 @@ export type ContactsGetStatuses = {
};
export type ContactsGetContacts = {
- hash: number
+ hash: string | number
};
export type ContactsImportContacts = {
@@ -10010,6 +10540,75 @@ export type ContactsGetBlocked = {
limit: number
};
+export type ContactsSearch = {
+ q: string,
+ limit: number
+};
+
+export type ContactsResolveUsername = {
+ username: string
+};
+
+export type ContactsGetTopPeers = {
+ flags?: number,
+ correspondents?: boolean,
+ bots_pm?: boolean,
+ bots_inline?: boolean,
+ phone_calls?: boolean,
+ forward_users?: boolean,
+ forward_chats?: boolean,
+ groups?: boolean,
+ channels?: boolean,
+ offset: number,
+ limit: number,
+ hash: string | number
+};
+
+export type ContactsResetTopPeerRating = {
+ category: TopPeerCategory,
+ peer: InputPeer
+};
+
+export type ContactsResetSaved = {
+
+};
+
+export type ContactsGetSaved = {
+
+};
+
+export type ContactsToggleTopPeers = {
+ enabled: boolean
+};
+
+export type ContactsAddContact = {
+ flags?: number,
+ add_phone_privacy_exception?: boolean,
+ id: InputUser,
+ first_name: string,
+ last_name: string,
+ phone: string
+};
+
+export type ContactsAcceptContact = {
+ id: InputUser
+};
+
+export type ContactsGetLocated = {
+ flags?: number,
+ background?: boolean,
+ geo_point: InputGeoPoint,
+ self_expires?: number
+};
+
+export type ContactsBlockFromReplies = {
+ flags?: number,
+ delete_message?: boolean,
+ delete_history?: boolean,
+ report_spam?: boolean,
+ msg_id: number
+};
+
export type MessagesGetMessages = {
id: Array
};
@@ -10022,7 +10621,7 @@ export type MessagesGetDialogs = {
offset_id: number,
offset_peer: InputPeer,
limit: number,
- hash: number
+ hash: string | number
};
export type MessagesGetHistory = {
@@ -10033,7 +10632,7 @@ export type MessagesGetHistory = {
limit: number,
max_id: number,
min_id: number,
- hash: number
+ hash: string | number
};
export type MessagesSearch = {
@@ -10050,7 +10649,7 @@ export type MessagesSearch = {
limit: number,
max_id: number,
min_id: number,
- hash: number
+ hash: string | number
};
export type MessagesReadHistory = {
@@ -10092,7 +10691,7 @@ export type MessagesSendMessage = {
peer: InputPeer,
reply_to_msg_id?: number,
message: string,
- random_id: string,
+ random_id: string | number,
reply_markup?: ReplyMarkup,
entities?: Array,
schedule_date?: number
@@ -10107,7 +10706,7 @@ export type MessagesSendMedia = {
reply_to_msg_id?: number,
media: InputMedia,
message: string,
- random_id: string,
+ random_id: string | number,
reply_markup?: ReplyMarkup,
entities?: Array,
schedule_date?: number
@@ -10118,9 +10717,11 @@ export type MessagesForwardMessages = {
silent?: boolean,
background?: boolean,
with_my_score?: boolean,
+ drop_author?: boolean,
+ drop_media_captions?: boolean,
from_peer: InputPeer,
id: Array,
- random_id: Array,
+ random_id: Array,
to_peer: InputPeer,
schedule_date?: number
};
@@ -10141,25 +10742,25 @@ export type MessagesReport = {
};
export type MessagesGetChats = {
- id: Array
+ id: Array
};
export type MessagesGetFullChat = {
- chat_id: number
+ chat_id: string | number
};
export type MessagesEditChatTitle = {
- chat_id: number,
+ chat_id: string | number,
title: string
};
export type MessagesEditChatPhoto = {
- chat_id: number,
+ chat_id: string | number,
photo: InputChatPhoto
};
export type MessagesAddChatUser = {
- chat_id: number,
+ chat_id: string | number,
user_id: InputUser,
fwd_limit: number
};
@@ -10167,7 +10768,7 @@ export type MessagesAddChatUser = {
export type MessagesDeleteChatUser = {
flags?: number,
revoke_history?: boolean,
- chat_id: number,
+ chat_id: string | number,
user_id: InputUser
};
@@ -10176,71 +10777,6 @@ export type MessagesCreateChat = {
title: string
};
-export type UpdatesGetState = {
-
-};
-
-export type UpdatesGetDifference = {
- flags?: number,
- pts: number,
- pts_total_limit?: number,
- date: number,
- qts: number
-};
-
-export type PhotosUpdateProfilePhoto = {
- id: InputPhoto
-};
-
-export type PhotosUploadProfilePhoto = {
- flags?: number,
- file?: InputFile,
- video?: InputFile,
- video_start_ts?: number
-};
-
-export type PhotosDeletePhotos = {
- id: Array
-};
-
-export type UploadSaveFilePart = {
- file_id: string,
- file_part: number,
- bytes: Uint8Array
-};
-
-export type UploadGetFile = {
- flags?: number,
- precise?: boolean,
- cdn_supported?: boolean,
- location: InputFileLocation,
- offset: number,
- limit: number
-};
-
-export type HelpGetConfig = {
-
-};
-
-export type HelpGetNearestDc = {
-
-};
-
-export type HelpGetAppUpdate = {
- source: string
-};
-
-export type HelpGetInviteText = {
-
-};
-
-export type PhotosGetUserPhotos = {
- user_id: InputUser,
- offset: number,
- max_id: string,
- limit: number
-};
-
export type MessagesGetDhConfig = {
version: number,
random_length: number
@@ -10255,7 +10791,7 @@ export type MessagesRequestEncryption = {
export type MessagesAcceptEncryption = {
peer: InputEncryptedChat,
g_b: Uint8Array,
- key_fingerprint: string
+ key_fingerprint: string | number
};
export type MessagesDiscardEncryption = {
@@ -10278,7 +10814,7 @@ export type MessagesSendEncrypted = {
flags?: number,
silent?: boolean,
peer: InputEncryptedChat,
- random_id: string,
+ random_id: string | number,
data: Uint8Array
};
@@ -10286,14 +10822,14 @@ export type MessagesSendEncryptedFile = {
flags?: number,
silent?: boolean,
peer: InputEncryptedChat,
- random_id: string,
+ random_id: string | number,
data: Uint8Array,
file: InputEncryptedFile
};
export type MessagesSendEncryptedService = {
peer: InputEncryptedChat,
- random_id: string,
+ random_id: string | number,
data: Uint8Array
};
@@ -10305,107 +10841,17 @@ export type MessagesReportEncryptedSpam = {
peer: InputEncryptedChat
};
-export type UploadSaveBigFilePart = {
- file_id: string,
- file_part: number,
- file_total_parts: number,
- bytes: Uint8Array
-};
-
-export type InitConnection = {
- flags?: number,
- api_id: number,
- device_model: string,
- system_version: string,
- app_version: string,
- system_lang_code: string,
- lang_pack: string,
- lang_code: string,
- proxy?: InputClientProxy,
- params?: JSONValue,
- query: any
-};
-
-export type HelpGetSupport = {
-
-};
-
export type MessagesReadMessageContents = {
id: Array
};
-export type AccountCheckUsername = {
- username: string
-};
-
-export type AccountUpdateUsername = {
- username: string
-};
-
-export type ContactsSearch = {
- q: string,
- limit: number
-};
-
-export type AccountGetPrivacy = {
- key: InputPrivacyKey
-};
-
-export type AccountSetPrivacy = {
- key: InputPrivacyKey,
- rules: Array
-};
-
-export type AccountDeleteAccount = {
- reason: string
-};
-
-export type AccountGetAccountTTL = {
-
-};
-
-export type AccountSetAccountTTL = {
- ttl: AccountDaysTTL
-};
-
-export type InvokeWithLayer = {
- layer: number,
- query: any
-};
-
-export type ContactsResolveUsername = {
- username: string
-};
-
-export type AccountSendChangePhoneCode = {
- phone_number: string,
- settings: CodeSettings
-};
-
-export type AccountChangePhone = {
- phone_number: string,
- phone_code_hash: string,
- phone_code: string
-};
-
export type MessagesGetStickers = {
emoticon: string,
- hash: number
+ hash: string | number
};
export type MessagesGetAllStickers = {
- hash: number
-};
-
-export type AccountUpdateDeviceLocked = {
- period: number
-};
-
-export type AuthImportBotAuthorization = {
- flags?: number,
- api_id: number,
- api_hash: string,
- bot_auth_token: string
+ hash: string | number
};
export type MessagesGetWebPagePreview = {
@@ -10414,45 +10860,6 @@ export type MessagesGetWebPagePreview = {
entities?: Array
};
-export type AccountGetAuthorizations = {
-
-};
-
-export type AccountResetAuthorization = {
- hash: string
-};
-
-export type AccountGetPassword = {
-
-};
-
-export type AccountGetPasswordSettings = {
- password: InputCheckPasswordSRP
-};
-
-export type AccountUpdatePasswordSettings = {
- password: InputCheckPasswordSRP,
- new_settings: AccountPasswordInputSettings
-};
-
-export type AuthCheckPassword = {
- password: InputCheckPasswordSRP
-};
-
-export type AuthRequestPasswordRecovery = {
-
-};
-
-export type AuthRecoverPassword = {
- flags?: number,
- code: string,
- new_settings?: AccountPasswordInputSettings
-};
-
-export type InvokeWithoutUpdates = {
- query: any
-};
-
export type MessagesExportChatInvite = {
flags?: number,
legacy_revoke_permanent?: boolean,
@@ -10485,20 +10892,806 @@ export type MessagesUninstallStickerSet = {
export type MessagesStartBot = {
bot: InputUser,
peer: InputPeer,
- random_id: string,
+ random_id: string | number,
start_param: string
};
-export type HelpGetAppChangelog = {
- prev_app_version: string
-};
-
export type MessagesGetMessagesViews = {
peer: InputPeer,
id: Array,
increment: boolean
};
+export type MessagesEditChatAdmin = {
+ chat_id: string | number,
+ user_id: InputUser,
+ is_admin: boolean
+};
+
+export type MessagesMigrateChat = {
+ chat_id: string | number
+};
+
+export type MessagesSearchGlobal = {
+ flags?: number,
+ folder_id?: number,
+ q: string,
+ filter: MessagesFilter,
+ min_date: number,
+ max_date: number,
+ offset_rate: number,
+ offset_peer: InputPeer,
+ offset_id: number,
+ limit: number
+};
+
+export type MessagesReorderStickerSets = {
+ flags?: number,
+ masks?: boolean,
+ order: Array
+};
+
+export type MessagesGetDocumentByHash = {
+ sha256: Uint8Array,
+ size: number,
+ mime_type: string
+};
+
+export type MessagesGetSavedGifs = {
+ hash: string | number
+};
+
+export type MessagesSaveGif = {
+ id: InputDocument,
+ unsave: boolean
+};
+
+export type MessagesGetInlineBotResults = {
+ flags?: number,
+ bot: InputUser,
+ peer: InputPeer,
+ geo_point?: InputGeoPoint,
+ query: string,
+ offset: string
+};
+
+export type MessagesSetInlineBotResults = {
+ flags?: number,
+ gallery?: boolean,
+ private?: boolean,
+ query_id: string | number,
+ results: Array,
+ cache_time: number,
+ next_offset?: string,
+ switch_pm?: InlineBotSwitchPM
+};
+
+export type MessagesSendInlineBotResult = {
+ flags?: number,
+ silent?: boolean,
+ background?: boolean,
+ clear_draft?: boolean,
+ hide_via?: boolean,
+ peer: InputPeer,
+ reply_to_msg_id?: number,
+ random_id: string | number,
+ query_id: string | number,
+ id: string,
+ schedule_date?: number
+};
+
+export type MessagesGetMessageEditData = {
+ peer: InputPeer,
+ id: number
+};
+
+export type MessagesEditMessage = {
+ flags?: number,
+ no_webpage?: boolean,
+ peer: InputPeer,
+ id: number,
+ message?: string,
+ media?: InputMedia,
+ reply_markup?: ReplyMarkup,
+ entities?: Array,
+ schedule_date?: number
+};
+
+export type MessagesEditInlineBotMessage = {
+ flags?: number,
+ no_webpage?: boolean,
+ id: InputBotInlineMessageID,
+ message?: string,
+ media?: InputMedia,
+ reply_markup?: ReplyMarkup,
+ entities?: Array
+};
+
+export type MessagesGetBotCallbackAnswer = {
+ flags?: number,
+ game?: boolean,
+ peer: InputPeer,
+ msg_id: number,
+ data?: Uint8Array,
+ password?: InputCheckPasswordSRP
+};
+
+export type MessagesSetBotCallbackAnswer = {
+ flags?: number,
+ alert?: boolean,
+ query_id: string | number,
+ message?: string,
+ url?: string,
+ cache_time: number
+};
+
+export type MessagesGetPeerDialogs = {
+ peers: Array
+};
+
+export type MessagesSaveDraft = {
+ flags?: number,
+ no_webpage?: boolean,
+ reply_to_msg_id?: number,
+ peer: InputPeer,
+ message: string,
+ entities?: Array
+};
+
+export type MessagesGetAllDrafts = {
+
+};
+
+export type MessagesGetFeaturedStickers = {
+ hash: string | number
+};
+
+export type MessagesReadFeaturedStickers = {
+ id: Array
+};
+
+export type MessagesGetRecentStickers = {
+ flags?: number,
+ attached?: boolean,
+ hash: string | number
+};
+
+export type MessagesSaveRecentSticker = {
+ flags?: number,
+ attached?: boolean,
+ id: InputDocument,
+ unsave: boolean
+};
+
+export type MessagesClearRecentStickers = {
+ flags?: number,
+ attached?: boolean
+};
+
+export type MessagesGetArchivedStickers = {
+ flags?: number,
+ masks?: boolean,
+ offset_id: string | number,
+ limit: number
+};
+
+export type MessagesGetMaskStickers = {
+ hash: string | number
+};
+
+export type MessagesGetAttachedStickers = {
+ media: InputStickeredMedia
+};
+
+export type MessagesSetGameScore = {
+ flags?: number,
+ edit_message?: boolean,
+ force?: boolean,
+ peer: InputPeer,
+ id: number,
+ user_id: InputUser,
+ score: number
+};
+
+export type MessagesSetInlineGameScore = {
+ flags?: number,
+ edit_message?: boolean,
+ force?: boolean,
+ id: InputBotInlineMessageID,
+ user_id: InputUser,
+ score: number
+};
+
+export type MessagesGetGameHighScores = {
+ peer: InputPeer,
+ id: number,
+ user_id: InputUser
+};
+
+export type MessagesGetInlineGameHighScores = {
+ id: InputBotInlineMessageID,
+ user_id: InputUser
+};
+
+export type MessagesGetCommonChats = {
+ user_id: InputUser,
+ max_id: string | number,
+ limit: number
+};
+
+export type MessagesGetAllChats = {
+ except_ids: Array
+};
+
+export type MessagesGetWebPage = {
+ url: string,
+ hash: number
+};
+
+export type MessagesToggleDialogPin = {
+ flags?: number,
+ pinned?: boolean,
+ peer: InputDialogPeer
+};
+
+export type MessagesReorderPinnedDialogs = {
+ flags?: number,
+ force?: boolean,
+ folder_id: number,
+ order: Array
+};
+
+export type MessagesGetPinnedDialogs = {
+ folder_id: number
+};
+
+export type MessagesSetBotShippingResults = {
+ flags?: number,
+ query_id: string | number,
+ error?: string,
+ shipping_options?: Array
+};
+
+export type MessagesSetBotPrecheckoutResults = {
+ flags?: number,
+ success?: boolean,
+ query_id: string | number,
+ error?: string
+};
+
+export type MessagesUploadMedia = {
+ peer: InputPeer,
+ media: InputMedia
+};
+
+export type MessagesSendScreenshotNotification = {
+ peer: InputPeer,
+ reply_to_msg_id: number,
+ random_id: string | number
+};
+
+export type MessagesGetFavedStickers = {
+ hash: string | number
+};
+
+export type MessagesFaveSticker = {
+ id: InputDocument,
+ unfave: boolean
+};
+
+export type MessagesGetUnreadMentions = {
+ peer: InputPeer,
+ offset_id: number,
+ add_offset: number,
+ limit: number,
+ max_id: number,
+ min_id: number
+};
+
+export type MessagesReadMentions = {
+ peer: InputPeer
+};
+
+export type MessagesGetRecentLocations = {
+ peer: InputPeer,
+ limit: number,
+ hash: string | number
+};
+
+export type MessagesSendMultiMedia = {
+ flags?: number,
+ silent?: boolean,
+ background?: boolean,
+ clear_draft?: boolean,
+ peer: InputPeer,
+ reply_to_msg_id?: number,
+ multi_media: Array,
+ schedule_date?: number
+};
+
+export type MessagesUploadEncryptedFile = {
+ peer: InputEncryptedChat,
+ file: InputEncryptedFile
+};
+
+export type MessagesSearchStickerSets = {
+ flags?: number,
+ exclude_featured?: boolean,
+ q: string,
+ hash: string | number
+};
+
+export type MessagesGetSplitRanges = {
+
+};
+
+export type MessagesMarkDialogUnread = {
+ flags?: number,
+ unread?: boolean,
+ peer: InputDialogPeer
+};
+
+export type MessagesGetDialogUnreadMarks = {
+
+};
+
+export type MessagesClearAllDrafts = {
+
+};
+
+export type MessagesUpdatePinnedMessage = {
+ flags?: number,
+ silent?: boolean,
+ unpin?: boolean,
+ pm_oneside?: boolean,
+ peer: InputPeer,
+ id: number
+};
+
+export type MessagesSendVote = {
+ peer: InputPeer,
+ msg_id: number,
+ options: Array
+};
+
+export type MessagesGetPollResults = {
+ peer: InputPeer,
+ msg_id: number
+};
+
+export type MessagesGetOnlines = {
+ peer: InputPeer
+};
+
+export type MessagesGetStatsURL = {
+ flags?: number,
+ dark?: boolean,
+ peer: InputPeer,
+ params: string
+};
+
+export type MessagesEditChatAbout = {
+ peer: InputPeer,
+ about: string
+};
+
+export type MessagesEditChatDefaultBannedRights = {
+ peer: InputPeer,
+ banned_rights: ChatBannedRights
+};
+
+export type MessagesGetEmojiKeywords = {
+ lang_code: string
+};
+
+export type MessagesGetEmojiKeywordsDifference = {
+ lang_code: string,
+ from_version: number
+};
+
+export type MessagesGetEmojiKeywordsLanguages = {
+ lang_codes: Array
+};
+
+export type MessagesGetEmojiURL = {
+ lang_code: string
+};
+
+export type MessagesGetSearchCounters = {
+ peer: InputPeer,
+ filters: Array
+};
+
+export type MessagesRequestUrlAuth = {
+ flags?: number,
+ peer?: InputPeer,
+ msg_id?: number,
+ button_id?: number,
+ url?: string
+};
+
+export type MessagesAcceptUrlAuth = {
+ flags?: number,
+ write_allowed?: boolean,
+ peer?: InputPeer,
+ msg_id?: number,
+ button_id?: number,
+ url?: string
+};
+
+export type MessagesHidePeerSettingsBar = {
+ peer: InputPeer
+};
+
+export type MessagesGetScheduledHistory = {
+ peer: InputPeer,
+ hash: string | number
+};
+
+export type MessagesGetScheduledMessages = {
+ peer: InputPeer,
+ id: Array
+};
+
+export type MessagesSendScheduledMessages = {
+ peer: InputPeer,
+ id: Array
+};
+
+export type MessagesDeleteScheduledMessages = {
+ peer: InputPeer,
+ id: Array
+};
+
+export type MessagesGetPollVotes = {
+ flags?: number,
+ peer: InputPeer,
+ id: number,
+ option?: Uint8Array,
+ offset?: string,
+ limit: number
+};
+
+export type MessagesToggleStickerSets = {
+ flags?: number,
+ uninstall?: boolean,
+ archive?: boolean,
+ unarchive?: boolean,
+ stickersets: Array
+};
+
+export type MessagesGetDialogFilters = {
+
+};
+
+export type MessagesGetSuggestedDialogFilters = {
+
+};
+
+export type MessagesUpdateDialogFilter = {
+ flags?: number,
+ id: number,
+ filter?: DialogFilter
+};
+
+export type MessagesUpdateDialogFiltersOrder = {
+ order: Array
+};
+
+export type MessagesGetOldFeaturedStickers = {
+ offset: number,
+ limit: number,
+ hash: string | number
+};
+
+export type MessagesGetReplies = {
+ peer: InputPeer,
+ msg_id: number,
+ offset_id: number,
+ offset_date: number,
+ add_offset: number,
+ limit: number,
+ max_id: number,
+ min_id: number,
+ hash: string | number
+};
+
+export type MessagesGetDiscussionMessage = {
+ peer: InputPeer,
+ msg_id: number
+};
+
+export type MessagesReadDiscussion = {
+ peer: InputPeer,
+ msg_id: number,
+ read_max_id: number
+};
+
+export type MessagesUnpinAllMessages = {
+ peer: InputPeer
+};
+
+export type MessagesDeleteChat = {
+ chat_id: string | number
+};
+
+export type MessagesDeletePhoneCallHistory = {
+ flags?: number,
+ revoke?: boolean
+};
+
+export type MessagesCheckHistoryImport = {
+ import_head: string
+};
+
+export type MessagesInitHistoryImport = {
+ peer: InputPeer,
+ file: InputFile,
+ media_count: number
+};
+
+export type MessagesUploadImportedMedia = {
+ peer: InputPeer,
+ import_id: string | number,
+ file_name: string,
+ media: InputMedia
+};
+
+export type MessagesStartHistoryImport = {
+ peer: InputPeer,
+ import_id: string | number
+};
+
+export type MessagesGetExportedChatInvites = {
+ flags?: number,
+ revoked?: boolean,
+ peer: InputPeer,
+ admin_id: InputUser,
+ offset_date?: number,
+ offset_link?: string,
+ limit: number
+};
+
+export type MessagesGetExportedChatInvite = {
+ peer: InputPeer,
+ link: string
+};
+
+export type MessagesEditExportedChatInvite = {
+ flags?: number,
+ revoked?: boolean,
+ peer: InputPeer,
+ link: string,
+ expire_date?: number,
+ usage_limit?: number
+};
+
+export type MessagesDeleteRevokedExportedChatInvites = {
+ peer: InputPeer,
+ admin_id: InputUser
+};
+
+export type MessagesDeleteExportedChatInvite = {
+ peer: InputPeer,
+ link: string
+};
+
+export type MessagesGetAdminsWithInvites = {
+ peer: InputPeer
+};
+
+export type MessagesGetChatInviteImporters = {
+ peer: InputPeer,
+ link: string,
+ offset_date: number,
+ offset_user: InputUser,
+ limit: number
+};
+
+export type MessagesSetHistoryTTL = {
+ peer: InputPeer,
+ period: number
+};
+
+export type MessagesCheckHistoryImportPeer = {
+ peer: InputPeer
+};
+
+export type MessagesSetChatTheme = {
+ peer: InputPeer,
+ emoticon: string
+};
+
+export type MessagesGetMessageReadParticipants = {
+ peer: InputPeer,
+ msg_id: number
+};
+
+export type UpdatesGetState = {
+
+};
+
+export type UpdatesGetDifference = {
+ flags?: number,
+ pts: number,
+ pts_total_limit?: number,
+ date: number,
+ qts: number
+};
+
+export type UpdatesGetChannelDifference = {
+ flags?: number,
+ force?: boolean,
+ channel: InputChannel,
+ filter: ChannelMessagesFilter,
+ pts: number,
+ limit: number
+};
+
+export type PhotosUpdateProfilePhoto = {
+ id: InputPhoto
+};
+
+export type PhotosUploadProfilePhoto = {
+ flags?: number,
+ file?: InputFile,
+ video?: InputFile,
+ video_start_ts?: number
+};
+
+export type PhotosDeletePhotos = {
+ id: Array
+};
+
+export type PhotosGetUserPhotos = {
+ user_id: InputUser,
+ offset: number,
+ max_id: string | number,
+ limit: number
+};
+
+export type UploadSaveFilePart = {
+ file_id: string | number,
+ file_part: number,
+ bytes: Uint8Array
+};
+
+export type UploadGetFile = {
+ flags?: number,
+ precise?: boolean,
+ cdn_supported?: boolean,
+ location: InputFileLocation,
+ offset: number,
+ limit: number
+};
+
+export type UploadSaveBigFilePart = {
+ file_id: string | number,
+ file_part: number,
+ file_total_parts: number,
+ bytes: Uint8Array
+};
+
+export type UploadGetWebFile = {
+ location: InputWebFileLocation,
+ offset: number,
+ limit: number
+};
+
+export type UploadGetCdnFile = {
+ file_token: Uint8Array,
+ offset: number,
+ limit: number
+};
+
+export type UploadReuploadCdnFile = {
+ file_token: Uint8Array,
+ request_token: Uint8Array
+};
+
+export type UploadGetCdnFileHashes = {
+ file_token: Uint8Array,
+ offset: number
+};
+
+export type UploadGetFileHashes = {
+ location: InputFileLocation,
+ offset: number
+};
+
+export type HelpGetConfig = {
+
+};
+
+export type HelpGetNearestDc = {
+
+};
+
+export type HelpGetAppUpdate = {
+ source: string
+};
+
+export type HelpGetInviteText = {
+
+};
+
+export type HelpGetSupport = {
+
+};
+
+export type HelpGetAppChangelog = {
+ prev_app_version: string
+};
+
+export type HelpSetBotUpdatesStatus = {
+ pending_updates_count: number,
+ message: string
+};
+
+export type HelpGetCdnConfig = {
+
+};
+
+export type HelpGetRecentMeUrls = {
+ referer: string
+};
+
+export type HelpGetTermsOfServiceUpdate = {
+
+};
+
+export type HelpAcceptTermsOfService = {
+ id: DataJSON
+};
+
+export type HelpGetDeepLinkInfo = {
+ path: string
+};
+
+export type HelpGetAppConfig = {
+
+};
+
+export type HelpSaveAppLog = {
+ events: Array
+};
+
+export type HelpGetPassportConfig = {
+ hash: number
+};
+
+export type HelpGetSupportName = {
+
+};
+
+export type HelpGetUserInfo = {
+ user_id: InputUser
+};
+
+export type HelpEditUserInfo = {
+ user_id: InputUser,
+ message: string,
+ entities: Array
+};
+
+export type HelpGetPromoData = {
+
+};
+
+export type HelpHidePromoData = {
+ peer: InputPeer
+};
+
+export type HelpDismissSuggestion = {
+ peer: InputPeer,
+ suggestion: string
+};
+
+export type HelpGetCountriesList = {
+ lang_code: string,
+ hash: number
+};
+
export type ChannelsReadHistory = {
channel: InputChannel,
max_id: number
@@ -10530,7 +11723,7 @@ export type ChannelsGetParticipants = {
filter: ChannelParticipantsFilter,
offset: number,
limit: number,
- hash: number
+ hash: string | number
};
export type ChannelsGetParticipant = {
@@ -10601,93 +11794,6 @@ export type ChannelsDeleteChannel = {
channel: InputChannel
};
-export type UpdatesGetChannelDifference = {
- flags?: number,
- force?: boolean,
- channel: InputChannel,
- filter: ChannelMessagesFilter,
- pts: number,
- limit: number
-};
-
-export type MessagesEditChatAdmin = {
- chat_id: number,
- user_id: InputUser,
- is_admin: boolean
-};
-
-export type MessagesMigrateChat = {
- chat_id: number
-};
-
-export type MessagesSearchGlobal = {
- flags?: number,
- folder_id?: number,
- q: string,
- filter: MessagesFilter,
- min_date: number,
- max_date: number,
- offset_rate: number,
- offset_peer: InputPeer,
- offset_id: number,
- limit: number
-};
-
-export type MessagesReorderStickerSets = {
- flags?: number,
- masks?: boolean,
- order: Array
-};
-
-export type MessagesGetDocumentByHash = {
- sha256: Uint8Array,
- size: number,
- mime_type: string
-};
-
-export type MessagesGetSavedGifs = {
- hash: number
-};
-
-export type MessagesSaveGif = {
- id: InputDocument,
- unsave: boolean
-};
-
-export type MessagesGetInlineBotResults = {
- flags?: number,
- bot: InputUser,
- peer: InputPeer,
- geo_point?: InputGeoPoint,
- query: string,
- offset: string
-};
-
-export type MessagesSetInlineBotResults = {
- flags?: number,
- gallery?: boolean,
- private?: boolean,
- query_id: string,
- results: Array,
- cache_time: number,
- next_offset?: string,
- switch_pm?: InlineBotSwitchPM
-};
-
-export type MessagesSendInlineBotResult = {
- flags?: number,
- silent?: boolean,
- background?: boolean,
- clear_draft?: boolean,
- hide_via?: boolean,
- peer: InputPeer,
- reply_to_msg_id?: number,
- random_id: string,
- query_id: string,
- id: string,
- schedule_date?: number
-};
-
export type ChannelsExportMessageLink = {
flags?: number,
grouped?: boolean,
@@ -10701,224 +11807,94 @@ export type ChannelsToggleSignatures = {
enabled: boolean
};
-export type AuthResendCode = {
- phone_number: string,
- phone_code_hash: string
-};
-
-export type AuthCancelCode = {
- phone_number: string,
- phone_code_hash: string
-};
-
-export type MessagesGetMessageEditData = {
- peer: InputPeer,
- id: number
-};
-
-export type MessagesEditMessage = {
- flags?: number,
- no_webpage?: boolean,
- peer: InputPeer,
- id: number,
- message?: string,
- media?: InputMedia,
- reply_markup?: ReplyMarkup,
- entities?: Array