@mtkruto/node 0.0.938 → 0.0.940
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/connection/1_connection_web_socket.js +1 -1
- package/esm/constants.d.ts +1 -1
- package/esm/constants.js +1 -1
- package/esm/types/0_location.d.ts +2 -0
- package/esm/types/0_location.js +31 -1
- package/esm/types/0_venue.js +1 -1
- package/esm/types/1_keyboard_button.d.ts +1 -1
- package/esm/types/1_keyboard_button.js +1 -1
- package/esm/types/3_message.d.ts +2 -0
- package/esm/types/3_message.js +4 -0
- package/package.json +1 -1
- package/script/connection/1_connection_web_socket.js +1 -1
- package/script/constants.d.ts +1 -1
- package/script/constants.js +1 -1
- package/script/types/0_location.d.ts +2 -0
- package/script/types/0_location.js +56 -0
- package/script/types/0_venue.js +2 -2
- package/script/types/1_keyboard_button.d.ts +1 -1
- package/script/types/1_keyboard_button.js +1 -1
- package/script/types/3_message.d.ts +2 -0
- package/script/types/3_message.js +4 -0
package/esm/constants.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
|
|
|
4
4
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
5
5
|
export declare const DEFAULT_INITIAL_DC: DC;
|
|
6
6
|
export declare const LAYER = 158;
|
|
7
|
-
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
7
|
+
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.940";
|
|
8
8
|
export declare const DEFAULT_DEVICE_MODEL: string;
|
|
9
9
|
export declare const DEFAULT_LANG_CODE: string;
|
|
10
10
|
export declare const DEFAULT_LANG_PACK = "";
|
package/esm/constants.js
CHANGED
|
@@ -62,7 +62,7 @@ export const publicKeys = new Map([
|
|
|
62
62
|
export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
63
63
|
export const DEFAULT_INITIAL_DC = "2-test";
|
|
64
64
|
export const LAYER = 158;
|
|
65
|
-
export const DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
65
|
+
export const DEFAULT_APP_VERSION = "MTKruto 0.0.940";
|
|
66
66
|
// @ts-ignore: lib
|
|
67
67
|
export const DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
68
68
|
export const DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
1
2
|
export interface Location {
|
|
2
3
|
latitude: number;
|
|
3
4
|
longitude: number;
|
|
@@ -6,3 +7,4 @@ export interface Location {
|
|
|
6
7
|
heading?: number;
|
|
7
8
|
proximityAlertRadius?: number;
|
|
8
9
|
}
|
|
10
|
+
export declare function constructLocation(geo_: types.MessageMediaGeo | types.MessageMediaGeoLive | types.GeoPoint): Location;
|
package/esm/types/0_location.js
CHANGED
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
import { as } from "../tl/1_tl_object.js";
|
|
2
|
+
import * as types from "../tl/2_types.js";
|
|
3
|
+
export function constructLocation(geo_) {
|
|
4
|
+
if (geo_ instanceof types.MessageMediaGeo) {
|
|
5
|
+
const geo = geo_.geo[as](types.GeoPoint);
|
|
6
|
+
return {
|
|
7
|
+
latitude: geo.lat,
|
|
8
|
+
longitude: geo.long,
|
|
9
|
+
horizontalAccuracy: geo.accuracyRadius,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
else if (geo_ instanceof types.MessageMediaGeoLive) {
|
|
13
|
+
const media = geo_;
|
|
14
|
+
const geo = media.geo[as](types.GeoPoint);
|
|
15
|
+
return {
|
|
16
|
+
latitude: geo.lat,
|
|
17
|
+
longitude: geo.long,
|
|
18
|
+
horizontalAccuracy: geo.accuracyRadius,
|
|
19
|
+
livePeriod: media.period,
|
|
20
|
+
heading: media.heading,
|
|
21
|
+
proximityAlertRadius: media.proximityNotificationRadius,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return {
|
|
26
|
+
latitude: geo_.lat,
|
|
27
|
+
longitude: geo_.long,
|
|
28
|
+
horizontalAccuracy: geo_.accuracyRadius,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
package/esm/types/0_venue.js
CHANGED
|
@@ -61,4 +61,4 @@ export declare namespace KeyboardButton {
|
|
|
61
61
|
/** This object represents one button of the reply keyboard. For simple text buttons, _String_ can be used instead of this object to specify the button text. The optional fields _web_app_, _request_user_, _request_chat_, _request_contact_, _request_location_, and _request_poll_ are mutually exclusive. */
|
|
62
62
|
export type KeyboardButton = KeyboardButton.Text | KeyboardButton.RequestUser | KeyboardButton.RequestChat | KeyboardButton.RequestContact | KeyboardButton.RequestLocation | KeyboardButton.RequestPoll | KeyboardButton.WebApp;
|
|
63
63
|
export declare function constructKeyboardButton(button_: types.TypeKeyboardButton): KeyboardButton;
|
|
64
|
-
export declare function keyboardButtonToTlObject(button: KeyboardButton): types.KeyboardButtonRequestPhone | types.KeyboardButtonRequestGeoLocation | types.KeyboardButtonRequestPoll | types.KeyboardButtonWebView | types.KeyboardButtonRequestPeer;
|
|
64
|
+
export declare function keyboardButtonToTlObject(button: KeyboardButton): types.KeyboardButton | types.KeyboardButtonRequestPhone | types.KeyboardButtonRequestGeoLocation | types.KeyboardButtonRequestPoll | types.KeyboardButtonWebView | types.KeyboardButtonRequestPeer;
|
package/esm/types/3_message.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { Dice } from "./0_dice.js";
|
|
|
19
19
|
import { Contact } from "./0_contact.js";
|
|
20
20
|
import { Game } from "./2_game.js";
|
|
21
21
|
import { Venue } from "./0_venue.js";
|
|
22
|
+
import { Location } from "./0_location.js";
|
|
22
23
|
/** This object represents a message. */
|
|
23
24
|
export interface Message {
|
|
24
25
|
/** Unique message identifier inside this chat */
|
|
@@ -88,6 +89,7 @@ export interface Message {
|
|
|
88
89
|
contact?: Contact;
|
|
89
90
|
game?: Game;
|
|
90
91
|
venue?: Venue;
|
|
92
|
+
location?: Location;
|
|
91
93
|
}
|
|
92
94
|
interface EntityGetter {
|
|
93
95
|
(peer: types.PeerUser): MaybePromise<types.User | null>;
|
package/esm/types/3_message.js
CHANGED
|
@@ -22,6 +22,7 @@ import { FileID, FileType, FileUniqueID, FileUniqueType } from "./!0_file_id.js"
|
|
|
22
22
|
import { constructContact } from "./0_contact.js";
|
|
23
23
|
import { constructGame } from "./2_game.js";
|
|
24
24
|
import { constructVenue } from "./0_venue.js";
|
|
25
|
+
import { constructLocation } from "./0_location.js";
|
|
25
26
|
const d = debug("types/Message");
|
|
26
27
|
async function getSender(message_, getEntity) {
|
|
27
28
|
if (message_.fromId instanceof types.PeerUser) {
|
|
@@ -273,6 +274,9 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
273
274
|
else if (message_.media instanceof types.MessageMediaVenue) {
|
|
274
275
|
message.venue = constructVenue(message_.media);
|
|
275
276
|
}
|
|
277
|
+
else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
|
|
278
|
+
message.location = constructLocation(message_.media);
|
|
279
|
+
}
|
|
276
280
|
else {
|
|
277
281
|
console.log(message_.media);
|
|
278
282
|
// not implemented
|
package/package.json
CHANGED
package/script/constants.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
|
|
|
4
4
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
5
5
|
export declare const DEFAULT_INITIAL_DC: DC;
|
|
6
6
|
export declare const LAYER = 158;
|
|
7
|
-
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
7
|
+
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.940";
|
|
8
8
|
export declare const DEFAULT_DEVICE_MODEL: string;
|
|
9
9
|
export declare const DEFAULT_LANG_CODE: string;
|
|
10
10
|
export declare const DEFAULT_LANG_PACK = "";
|
package/script/constants.js
CHANGED
|
@@ -88,7 +88,7 @@ exports.publicKeys = new Map([
|
|
|
88
88
|
exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
89
89
|
exports.DEFAULT_INITIAL_DC = "2-test";
|
|
90
90
|
exports.LAYER = 158;
|
|
91
|
-
exports.DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
91
|
+
exports.DEFAULT_APP_VERSION = "MTKruto 0.0.940";
|
|
92
92
|
// @ts-ignore: lib
|
|
93
93
|
exports.DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
94
94
|
exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
1
2
|
export interface Location {
|
|
2
3
|
latitude: number;
|
|
3
4
|
longitude: number;
|
|
@@ -6,3 +7,4 @@ export interface Location {
|
|
|
6
7
|
heading?: number;
|
|
7
8
|
proximityAlertRadius?: number;
|
|
8
9
|
}
|
|
10
|
+
export declare function constructLocation(geo_: types.MessageMediaGeo | types.MessageMediaGeoLive | types.GeoPoint): Location;
|
|
@@ -1,2 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.constructLocation = void 0;
|
|
27
|
+
const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
28
|
+
const types = __importStar(require("../tl/2_types.js"));
|
|
29
|
+
function constructLocation(geo_) {
|
|
30
|
+
if (geo_ instanceof types.MessageMediaGeo) {
|
|
31
|
+
const geo = geo_.geo[_1_tl_object_js_1.as](types.GeoPoint);
|
|
32
|
+
return {
|
|
33
|
+
latitude: geo.lat,
|
|
34
|
+
longitude: geo.long,
|
|
35
|
+
horizontalAccuracy: geo.accuracyRadius,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else if (geo_ instanceof types.MessageMediaGeoLive) {
|
|
39
|
+
const media = geo_;
|
|
40
|
+
const geo = media.geo[_1_tl_object_js_1.as](types.GeoPoint);
|
|
41
|
+
return {
|
|
42
|
+
latitude: geo.lat,
|
|
43
|
+
longitude: geo.long,
|
|
44
|
+
horizontalAccuracy: geo.accuracyRadius,
|
|
45
|
+
livePeriod: media.period,
|
|
46
|
+
heading: media.heading,
|
|
47
|
+
proximityAlertRadius: media.proximityNotificationRadius,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return {
|
|
52
|
+
latitude: geo_.lat,
|
|
53
|
+
longitude: geo_.long,
|
|
54
|
+
horizontalAccuracy: geo_.accuracyRadius,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.constructLocation = constructLocation;
|
package/script/types/0_venue.js
CHANGED
|
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.constructVenue = void 0;
|
|
27
|
-
const
|
|
27
|
+
const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
28
28
|
const types = __importStar(require("../tl/2_types.js"));
|
|
29
29
|
function constructVenue(media_) {
|
|
30
|
-
const geo = media_.geo[
|
|
30
|
+
const geo = media_.geo[_1_tl_object_js_1.as](types.GeoPoint);
|
|
31
31
|
return {
|
|
32
32
|
location: {
|
|
33
33
|
latitude: geo.lat,
|
|
@@ -61,4 +61,4 @@ export declare namespace KeyboardButton {
|
|
|
61
61
|
/** This object represents one button of the reply keyboard. For simple text buttons, _String_ can be used instead of this object to specify the button text. The optional fields _web_app_, _request_user_, _request_chat_, _request_contact_, _request_location_, and _request_poll_ are mutually exclusive. */
|
|
62
62
|
export type KeyboardButton = KeyboardButton.Text | KeyboardButton.RequestUser | KeyboardButton.RequestChat | KeyboardButton.RequestContact | KeyboardButton.RequestLocation | KeyboardButton.RequestPoll | KeyboardButton.WebApp;
|
|
63
63
|
export declare function constructKeyboardButton(button_: types.TypeKeyboardButton): KeyboardButton;
|
|
64
|
-
export declare function keyboardButtonToTlObject(button: KeyboardButton): types.KeyboardButtonRequestPhone | types.KeyboardButtonRequestGeoLocation | types.KeyboardButtonRequestPoll | types.KeyboardButtonWebView | types.KeyboardButtonRequestPeer;
|
|
64
|
+
export declare function keyboardButtonToTlObject(button: KeyboardButton): types.KeyboardButton | types.KeyboardButtonRequestPhone | types.KeyboardButtonRequestGeoLocation | types.KeyboardButtonRequestPoll | types.KeyboardButtonWebView | types.KeyboardButtonRequestPeer;
|
|
@@ -155,7 +155,7 @@ function keyboardButtonToTlObject(button) {
|
|
|
155
155
|
return new types.KeyboardButtonWebView({ text: button.text, url: button.webApp.url });
|
|
156
156
|
}
|
|
157
157
|
else {
|
|
158
|
-
(
|
|
158
|
+
return new types.KeyboardButton({ text: button.text });
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
exports.keyboardButtonToTlObject = keyboardButtonToTlObject;
|
|
@@ -19,6 +19,7 @@ import { Dice } from "./0_dice.js";
|
|
|
19
19
|
import { Contact } from "./0_contact.js";
|
|
20
20
|
import { Game } from "./2_game.js";
|
|
21
21
|
import { Venue } from "./0_venue.js";
|
|
22
|
+
import { Location } from "./0_location.js";
|
|
22
23
|
/** This object represents a message. */
|
|
23
24
|
export interface Message {
|
|
24
25
|
/** Unique message identifier inside this chat */
|
|
@@ -88,6 +89,7 @@ export interface Message {
|
|
|
88
89
|
contact?: Contact;
|
|
89
90
|
game?: Game;
|
|
90
91
|
venue?: Venue;
|
|
92
|
+
location?: Location;
|
|
91
93
|
}
|
|
92
94
|
interface EntityGetter {
|
|
93
95
|
(peer: types.PeerUser): MaybePromise<types.User | null>;
|
|
@@ -48,6 +48,7 @@ const _0_file_id_js_1 = require("./!0_file_id.js");
|
|
|
48
48
|
const _0_contact_js_1 = require("./0_contact.js");
|
|
49
49
|
const _2_game_js_1 = require("./2_game.js");
|
|
50
50
|
const _0_venue_js_1 = require("./0_venue.js");
|
|
51
|
+
const _0_location_js_1 = require("./0_location.js");
|
|
51
52
|
const d = (0, deps_js_1.debug)("types/Message");
|
|
52
53
|
async function getSender(message_, getEntity) {
|
|
53
54
|
if (message_.fromId instanceof types.PeerUser) {
|
|
@@ -299,6 +300,9 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
|
|
|
299
300
|
else if (message_.media instanceof types.MessageMediaVenue) {
|
|
300
301
|
message.venue = (0, _0_venue_js_1.constructVenue)(message_.media);
|
|
301
302
|
}
|
|
303
|
+
else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
|
|
304
|
+
message.location = (0, _0_location_js_1.constructLocation)(message_.media);
|
|
305
|
+
}
|
|
302
306
|
else {
|
|
303
307
|
console.log(message_.media);
|
|
304
308
|
// not implemented
|