@mtkruto/node 0.0.937 → 0.0.939
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/constants.d.ts +1 -1
- package/esm/constants.js +1 -1
- package/esm/types/0_location.d.ts +10 -0
- package/esm/types/0_location.js +31 -0
- package/esm/types/0_venue.d.ts +10 -0
- package/esm/types/0_venue.js +16 -0
- package/esm/types/3_message.d.ts +4 -0
- package/esm/types/3_message.js +8 -0
- package/package.json +1 -1
- package/script/constants.d.ts +1 -1
- package/script/constants.js +1 -1
- package/script/types/0_location.d.ts +10 -0
- package/script/types/0_location.js +58 -0
- package/script/types/0_venue.d.ts +10 -0
- package/script/types/0_venue.js +43 -0
- package/script/types/3_message.d.ts +4 -0
- package/script/types/3_message.js +8 -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.939";
|
|
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.939";
|
|
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];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
export interface Location {
|
|
3
|
+
latitude: number;
|
|
4
|
+
longitude: number;
|
|
5
|
+
horizontalAccuracy?: number;
|
|
6
|
+
livePeriod?: number;
|
|
7
|
+
heading?: number;
|
|
8
|
+
proximityAlertRadius?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function constructLocation(geo_: types.MessageMediaGeo | types.MessageMediaGeoLive | types.GeoPoint): Location;
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
import { Location } from "./0_location.js";
|
|
3
|
+
export interface Venue {
|
|
4
|
+
location: Location;
|
|
5
|
+
title: string;
|
|
6
|
+
address: string;
|
|
7
|
+
foursquareId?: string;
|
|
8
|
+
foursquareType?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function constructVenue(media_: types.MessageMediaVenue): Venue;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { as } from "../tl/1_tl_object.js";
|
|
2
|
+
import * as types from "../tl/2_types.js";
|
|
3
|
+
export function constructVenue(media_) {
|
|
4
|
+
const geo = media_.geo[as](types.GeoPoint);
|
|
5
|
+
return {
|
|
6
|
+
location: {
|
|
7
|
+
latitude: geo.lat,
|
|
8
|
+
longitude: geo.long,
|
|
9
|
+
horizontalAccuracy: geo.accuracyRadius,
|
|
10
|
+
},
|
|
11
|
+
title: media_.title,
|
|
12
|
+
address: media_.address,
|
|
13
|
+
foursquareId: media_.venueId,
|
|
14
|
+
foursquareType: media_.venueType,
|
|
15
|
+
};
|
|
16
|
+
}
|
package/esm/types/3_message.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ import { Voice } from "./0_voice.js";
|
|
|
18
18
|
import { Dice } from "./0_dice.js";
|
|
19
19
|
import { Contact } from "./0_contact.js";
|
|
20
20
|
import { Game } from "./2_game.js";
|
|
21
|
+
import { Venue } from "./0_venue.js";
|
|
22
|
+
import { Location } from "./0_location.js";
|
|
21
23
|
/** This object represents a message. */
|
|
22
24
|
export interface Message {
|
|
23
25
|
/** Unique message identifier inside this chat */
|
|
@@ -86,6 +88,8 @@ export interface Message {
|
|
|
86
88
|
videoNote?: VideoNote;
|
|
87
89
|
contact?: Contact;
|
|
88
90
|
game?: Game;
|
|
91
|
+
venue?: Venue;
|
|
92
|
+
location?: Location;
|
|
89
93
|
}
|
|
90
94
|
interface EntityGetter {
|
|
91
95
|
(peer: types.PeerUser): MaybePromise<types.User | null>;
|
package/esm/types/3_message.js
CHANGED
|
@@ -21,6 +21,8 @@ import { constructDice } from "./0_dice.js";
|
|
|
21
21
|
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
|
+
import { constructVenue } from "./0_venue.js";
|
|
25
|
+
import { constructLocation } from "./0_location.js";
|
|
24
26
|
const d = debug("types/Message");
|
|
25
27
|
async function getSender(message_, getEntity) {
|
|
26
28
|
if (message_.fromId instanceof types.PeerUser) {
|
|
@@ -269,6 +271,12 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
|
|
|
269
271
|
else if (message_.media instanceof types.MessageMediaGame) {
|
|
270
272
|
message.game = constructGame(message_.media);
|
|
271
273
|
}
|
|
274
|
+
else if (message_.media instanceof types.MessageMediaVenue) {
|
|
275
|
+
message.venue = constructVenue(message_.media);
|
|
276
|
+
}
|
|
277
|
+
else if (message_.media instanceof types.MessageMediaGeo || message_.media instanceof types.MessageMediaGeoLive) {
|
|
278
|
+
message.location = constructLocation(message_.media);
|
|
279
|
+
}
|
|
272
280
|
else {
|
|
273
281
|
console.log(message_.media);
|
|
274
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.939";
|
|
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.939";
|
|
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];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
export interface Location {
|
|
3
|
+
latitude: number;
|
|
4
|
+
longitude: number;
|
|
5
|
+
horizontalAccuracy?: number;
|
|
6
|
+
livePeriod?: number;
|
|
7
|
+
heading?: number;
|
|
8
|
+
proximityAlertRadius?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function constructLocation(geo_: types.MessageMediaGeo | types.MessageMediaGeoLive | types.GeoPoint): Location;
|
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
};
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
import { Location } from "./0_location.js";
|
|
3
|
+
export interface Venue {
|
|
4
|
+
location: Location;
|
|
5
|
+
title: string;
|
|
6
|
+
address: string;
|
|
7
|
+
foursquareId?: string;
|
|
8
|
+
foursquareType?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function constructVenue(media_: types.MessageMediaVenue): Venue;
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.constructVenue = 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 constructVenue(media_) {
|
|
30
|
+
const geo = media_.geo[_1_tl_object_js_1.as](types.GeoPoint);
|
|
31
|
+
return {
|
|
32
|
+
location: {
|
|
33
|
+
latitude: geo.lat,
|
|
34
|
+
longitude: geo.long,
|
|
35
|
+
horizontalAccuracy: geo.accuracyRadius,
|
|
36
|
+
},
|
|
37
|
+
title: media_.title,
|
|
38
|
+
address: media_.address,
|
|
39
|
+
foursquareId: media_.venueId,
|
|
40
|
+
foursquareType: media_.venueType,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
exports.constructVenue = constructVenue;
|
|
@@ -18,6 +18,8 @@ import { Voice } from "./0_voice.js";
|
|
|
18
18
|
import { Dice } from "./0_dice.js";
|
|
19
19
|
import { Contact } from "./0_contact.js";
|
|
20
20
|
import { Game } from "./2_game.js";
|
|
21
|
+
import { Venue } from "./0_venue.js";
|
|
22
|
+
import { Location } from "./0_location.js";
|
|
21
23
|
/** This object represents a message. */
|
|
22
24
|
export interface Message {
|
|
23
25
|
/** Unique message identifier inside this chat */
|
|
@@ -86,6 +88,8 @@ export interface Message {
|
|
|
86
88
|
videoNote?: VideoNote;
|
|
87
89
|
contact?: Contact;
|
|
88
90
|
game?: Game;
|
|
91
|
+
venue?: Venue;
|
|
92
|
+
location?: Location;
|
|
89
93
|
}
|
|
90
94
|
interface EntityGetter {
|
|
91
95
|
(peer: types.PeerUser): MaybePromise<types.User | null>;
|
|
@@ -47,6 +47,8 @@ const _0_dice_js_1 = require("./0_dice.js");
|
|
|
47
47
|
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
|
+
const _0_venue_js_1 = require("./0_venue.js");
|
|
51
|
+
const _0_location_js_1 = require("./0_location.js");
|
|
50
52
|
const d = (0, deps_js_1.debug)("types/Message");
|
|
51
53
|
async function getSender(message_, getEntity) {
|
|
52
54
|
if (message_.fromId instanceof types.PeerUser) {
|
|
@@ -295,6 +297,12 @@ async function constructMessage(message_, getEntity, getMessage, getStickerSetNa
|
|
|
295
297
|
else if (message_.media instanceof types.MessageMediaGame) {
|
|
296
298
|
message.game = (0, _2_game_js_1.constructGame)(message_.media);
|
|
297
299
|
}
|
|
300
|
+
else if (message_.media instanceof types.MessageMediaVenue) {
|
|
301
|
+
message.venue = (0, _0_venue_js_1.constructVenue)(message_.media);
|
|
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
|
+
}
|
|
298
306
|
else {
|
|
299
307
|
console.log(message_.media);
|
|
300
308
|
// not implemented
|