@mtkruto/browser 0.139.0 → 0.140.0
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/types/2_story_interactive_area.d.ts +22 -1
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +63 -32
- package/package.json +1 -1
- package/script/types/2_story_interactive_area.d.ts +22 -1
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +63 -32
|
@@ -37,14 +37,17 @@ export interface _StoryInteractiveAreaPositionCommon {
|
|
|
37
37
|
}
|
|
38
38
|
/** @unlisted */
|
|
39
39
|
export interface StoryInteractiveAreaLocation extends _StoryInteractiveAreaPositionCommon {
|
|
40
|
+
type: "location";
|
|
40
41
|
location: Location;
|
|
41
42
|
}
|
|
42
43
|
/** @unlisted */
|
|
43
44
|
export interface StoryInteractiveAreaVenue extends _StoryInteractiveAreaPositionCommon {
|
|
45
|
+
type: "venue";
|
|
44
46
|
venue: Venue;
|
|
45
47
|
}
|
|
46
48
|
/** @unlisted */
|
|
47
49
|
export interface StoryInteractiveAreaReaction extends _StoryInteractiveAreaPositionCommon {
|
|
50
|
+
type: "reaction";
|
|
48
51
|
reaction: Reaction;
|
|
49
52
|
count?: number;
|
|
50
53
|
isDark?: boolean;
|
|
@@ -52,10 +55,28 @@ export interface StoryInteractiveAreaReaction extends _StoryInteractiveAreaPosit
|
|
|
52
55
|
}
|
|
53
56
|
/** @unlisted */
|
|
54
57
|
export interface StoryInteractiveAreaMessage extends _StoryInteractiveAreaPositionCommon {
|
|
58
|
+
type: "messageReference";
|
|
55
59
|
messageReference: MessageReference;
|
|
56
60
|
}
|
|
61
|
+
/** @unlisted */
|
|
62
|
+
export interface StoryInteractiveAreaLink extends _StoryInteractiveAreaPositionCommon {
|
|
63
|
+
type: "link";
|
|
64
|
+
link: string;
|
|
65
|
+
}
|
|
66
|
+
/** @unlisted */
|
|
67
|
+
export interface StoryInteractiveAreaWeather extends _StoryInteractiveAreaPositionCommon {
|
|
68
|
+
type: "weather";
|
|
69
|
+
emoji: string;
|
|
70
|
+
temperature: number;
|
|
71
|
+
color: number;
|
|
72
|
+
}
|
|
73
|
+
/** @unlisted */
|
|
74
|
+
export interface StoryInteractiveAreaGift extends _StoryInteractiveAreaPositionCommon {
|
|
75
|
+
type: "gift";
|
|
76
|
+
slug: string;
|
|
77
|
+
}
|
|
57
78
|
/** A story's interactive area. */
|
|
58
|
-
export type StoryInteractiveArea = StoryInteractiveAreaLocation | StoryInteractiveAreaVenue | StoryInteractiveAreaReaction | StoryInteractiveAreaMessage;
|
|
79
|
+
export type StoryInteractiveArea = StoryInteractiveAreaLocation | StoryInteractiveAreaVenue | StoryInteractiveAreaReaction | StoryInteractiveAreaMessage | StoryInteractiveAreaLink | StoryInteractiveAreaWeather | StoryInteractiveAreaGift;
|
|
59
80
|
export declare function constructStoryInteractiveArea(area: Api.MediaArea): StoryInteractiveArea;
|
|
60
81
|
export declare function storyInteractiveAreaToTlObject(area: StoryInteractiveArea, getPeer: PeerGetter): Api.MediaArea;
|
|
61
82
|
//# sourceMappingURL=2_story_interactive_area.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_story_interactive_area.d.ts","sourceRoot":"","sources":["../../src/types/2_story_interactive_area.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAqB,KAAK,QAAQ,EAAsB,MAAM,iBAAiB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1D,gBAAgB;AAChB,MAAM,WAAW,4BAA4B;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,gBAAgB;AAChB,MAAM,WAAW,mCAAmC;IAClD,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED,gBAAgB;AAChB,MAAM,WAAW,4BAA6B,SAAQ,mCAAmC;IACvF,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,gBAAgB;AAChB,MAAM,WAAW,yBAA0B,SAAQ,mCAAmC;IACpF,KAAK,EAAE,KAAK,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,4BAA6B,SAAQ,mCAAmC;IACvF,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,2BAA4B,SAAQ,mCAAmC;IACtF,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,kCAAkC;AAClC,MAAM,MAAM,oBAAoB,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,4BAA4B,GAC5B,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"2_story_interactive_area.d.ts","sourceRoot":"","sources":["../../src/types/2_story_interactive_area.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAqB,KAAK,QAAQ,EAAsB,MAAM,iBAAiB,CAAC;AACvF,OAAO,K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MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAyB,SAAQ,mCAAmC;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,kCAAkC;AAClC,MAAM,MAAM,oBAAoB,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,4BAA4B,GAC5B,2BAA2B,GAC3B,wBAAwB,GACxB,2BAA2B,GAC3B,wBAAwB,CAAC;AAW7B,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,GAAG,CAAC,SAAS,GAAG,oBAAoB,CAqDvF;AAKD,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,GAAG,GAAG,CAAC,SAAS,CA0C7G"}
|
|
@@ -39,15 +39,16 @@ export function constructStoryInteractiveArea(area) {
|
|
|
39
39
|
unreachable(); // will this ever be empty?
|
|
40
40
|
}
|
|
41
41
|
const location = constructLocation(area.geo);
|
|
42
|
-
return { position, location };
|
|
42
|
+
return { type: "location", position, location };
|
|
43
43
|
}
|
|
44
44
|
else if (Api.is("mediaAreaVenue", area)) {
|
|
45
45
|
const venue = constructVenue(area);
|
|
46
|
-
return { position, venue };
|
|
46
|
+
return { type: "venue", position, venue };
|
|
47
47
|
}
|
|
48
48
|
else if (Api.is("mediaAreaSuggestedReaction", area)) {
|
|
49
49
|
const reaction = constructReaction(area.reaction);
|
|
50
50
|
return {
|
|
51
|
+
type: "reaction",
|
|
51
52
|
position,
|
|
52
53
|
reaction,
|
|
53
54
|
count: 0, // TODO: count
|
|
@@ -57,6 +58,7 @@ export function constructStoryInteractiveArea(area) {
|
|
|
57
58
|
}
|
|
58
59
|
else if (Api.is("mediaAreaChannelPost", area)) {
|
|
59
60
|
return {
|
|
61
|
+
type: "messageReference",
|
|
60
62
|
position,
|
|
61
63
|
messageReference: {
|
|
62
64
|
chatId: Api.peerToChatId(area),
|
|
@@ -64,6 +66,29 @@ export function constructStoryInteractiveArea(area) {
|
|
|
64
66
|
},
|
|
65
67
|
};
|
|
66
68
|
}
|
|
69
|
+
else if (Api.is("mediaAreaUrl", area)) {
|
|
70
|
+
return {
|
|
71
|
+
type: "link",
|
|
72
|
+
position,
|
|
73
|
+
link: area.url,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else if (Api.is("mediaAreaWeather", area)) {
|
|
77
|
+
return {
|
|
78
|
+
type: "weather",
|
|
79
|
+
position,
|
|
80
|
+
emoji: area.emoji,
|
|
81
|
+
temperature: area.temperature_c,
|
|
82
|
+
color: area.color,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
else if (Api.is("mediaAreaStarGift", area)) {
|
|
86
|
+
return {
|
|
87
|
+
type: "gift",
|
|
88
|
+
position,
|
|
89
|
+
slug: area.slug,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
67
92
|
else {
|
|
68
93
|
unreachable();
|
|
69
94
|
}
|
|
@@ -73,36 +98,42 @@ function storyInteractiveAreaPositionToTlObject(position) {
|
|
|
73
98
|
}
|
|
74
99
|
export function storyInteractiveAreaToTlObject(area, getPeer) {
|
|
75
100
|
const coordinates = storyInteractiveAreaPositionToTlObject(area.position);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
else if ("venue" in area) {
|
|
81
|
-
const geo = { _: "geoPoint", lat: area.venue.location.latitude, long: area.venue.location.longitude, access_hash: 0n, accuracy_radius: area.venue.location.horizontalAccuracy };
|
|
82
|
-
return {
|
|
83
|
-
_: "mediaAreaVenue",
|
|
84
|
-
coordinates,
|
|
85
|
-
geo,
|
|
86
|
-
address: area.venue.address,
|
|
87
|
-
provider: "foursquare",
|
|
88
|
-
title: area.venue.title,
|
|
89
|
-
venue_id: area.venue.foursquareId || "",
|
|
90
|
-
venue_type: area.venue.foursquareType || "",
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
else if ("reaction" in area) {
|
|
94
|
-
const reaction = reactionToTlObject(area.reaction);
|
|
95
|
-
return { _: "mediaAreaSuggestedReaction", coordinates, reaction, dark: area.isDark ? true : undefined, flipped: area.isFlipped ? true : undefined };
|
|
96
|
-
}
|
|
97
|
-
else if ("messageReference" in area) {
|
|
98
|
-
const peer = getPeer(Api.chatIdToPeer(area.messageReference.chatId));
|
|
99
|
-
if (!peer || peer[0].type !== "channel") {
|
|
100
|
-
unreachable();
|
|
101
|
+
switch (area.type) {
|
|
102
|
+
case "location": {
|
|
103
|
+
const geo = { _: "geoPoint", lat: area.location.latitude, long: area.location.longitude, access_hash: 0n, accuracy_radius: area.location.horizontalAccuracy };
|
|
104
|
+
return { _: "mediaAreaGeoPoint", coordinates, geo };
|
|
101
105
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
case "venue": {
|
|
107
|
+
const geo = { _: "geoPoint", lat: area.venue.location.latitude, long: area.venue.location.longitude, access_hash: 0n, accuracy_radius: area.venue.location.horizontalAccuracy };
|
|
108
|
+
return {
|
|
109
|
+
_: "mediaAreaVenue",
|
|
110
|
+
coordinates,
|
|
111
|
+
geo,
|
|
112
|
+
address: area.venue.address,
|
|
113
|
+
provider: "foursquare",
|
|
114
|
+
title: area.venue.title,
|
|
115
|
+
venue_id: area.venue.foursquareId || "",
|
|
116
|
+
venue_type: area.venue.foursquareType || "",
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
case "reaction": {
|
|
120
|
+
const reaction = reactionToTlObject(area.reaction);
|
|
121
|
+
return { _: "mediaAreaSuggestedReaction", coordinates, reaction, dark: area.isDark ? true : undefined, flipped: area.isFlipped ? true : undefined };
|
|
122
|
+
}
|
|
123
|
+
case "messageReference": {
|
|
124
|
+
const peer = getPeer(Api.chatIdToPeer(area.messageReference.chatId));
|
|
125
|
+
if (!peer || peer[0].type !== "channel") {
|
|
126
|
+
unreachable();
|
|
127
|
+
}
|
|
128
|
+
const channel = { _: "inputChannel", channel_id: chatIdToPeerId(peer[0].id), access_hash: peer[1] };
|
|
129
|
+
return { _: "inputMediaAreaChannelPost", coordinates, channel, msg_id: area.messageReference.messageId };
|
|
130
|
+
}
|
|
131
|
+
case "link":
|
|
132
|
+
return { _: "mediaAreaUrl", coordinates, url: area.link };
|
|
133
|
+
case "weather":
|
|
134
|
+
return { _: "mediaAreaWeather", coordinates, emoji: area.emoji, temperature_c: area.temperature, color: area.color };
|
|
135
|
+
case "gift":
|
|
136
|
+
return { _: "mediaAreaStarGift", coordinates, slug: area.slug };
|
|
107
137
|
}
|
|
138
|
+
unreachable();
|
|
108
139
|
}
|
package/package.json
CHANGED
|
@@ -37,14 +37,17 @@ export interface _StoryInteractiveAreaPositionCommon {
|
|
|
37
37
|
}
|
|
38
38
|
/** @unlisted */
|
|
39
39
|
export interface StoryInteractiveAreaLocation extends _StoryInteractiveAreaPositionCommon {
|
|
40
|
+
type: "location";
|
|
40
41
|
location: Location;
|
|
41
42
|
}
|
|
42
43
|
/** @unlisted */
|
|
43
44
|
export interface StoryInteractiveAreaVenue extends _StoryInteractiveAreaPositionCommon {
|
|
45
|
+
type: "venue";
|
|
44
46
|
venue: Venue;
|
|
45
47
|
}
|
|
46
48
|
/** @unlisted */
|
|
47
49
|
export interface StoryInteractiveAreaReaction extends _StoryInteractiveAreaPositionCommon {
|
|
50
|
+
type: "reaction";
|
|
48
51
|
reaction: Reaction;
|
|
49
52
|
count?: number;
|
|
50
53
|
isDark?: boolean;
|
|
@@ -52,10 +55,28 @@ export interface StoryInteractiveAreaReaction extends _StoryInteractiveAreaPosit
|
|
|
52
55
|
}
|
|
53
56
|
/** @unlisted */
|
|
54
57
|
export interface StoryInteractiveAreaMessage extends _StoryInteractiveAreaPositionCommon {
|
|
58
|
+
type: "messageReference";
|
|
55
59
|
messageReference: MessageReference;
|
|
56
60
|
}
|
|
61
|
+
/** @unlisted */
|
|
62
|
+
export interface StoryInteractiveAreaLink extends _StoryInteractiveAreaPositionCommon {
|
|
63
|
+
type: "link";
|
|
64
|
+
link: string;
|
|
65
|
+
}
|
|
66
|
+
/** @unlisted */
|
|
67
|
+
export interface StoryInteractiveAreaWeather extends _StoryInteractiveAreaPositionCommon {
|
|
68
|
+
type: "weather";
|
|
69
|
+
emoji: string;
|
|
70
|
+
temperature: number;
|
|
71
|
+
color: number;
|
|
72
|
+
}
|
|
73
|
+
/** @unlisted */
|
|
74
|
+
export interface StoryInteractiveAreaGift extends _StoryInteractiveAreaPositionCommon {
|
|
75
|
+
type: "gift";
|
|
76
|
+
slug: string;
|
|
77
|
+
}
|
|
57
78
|
/** A story's interactive area. */
|
|
58
|
-
export type StoryInteractiveArea = StoryInteractiveAreaLocation | StoryInteractiveAreaVenue | StoryInteractiveAreaReaction | StoryInteractiveAreaMessage;
|
|
79
|
+
export type StoryInteractiveArea = StoryInteractiveAreaLocation | StoryInteractiveAreaVenue | StoryInteractiveAreaReaction | StoryInteractiveAreaMessage | StoryInteractiveAreaLink | StoryInteractiveAreaWeather | StoryInteractiveAreaGift;
|
|
59
80
|
export declare function constructStoryInteractiveArea(area: Api.MediaArea): StoryInteractiveArea;
|
|
60
81
|
export declare function storyInteractiveAreaToTlObject(area: StoryInteractiveArea, getPeer: PeerGetter): Api.MediaArea;
|
|
61
82
|
//# sourceMappingURL=2_story_interactive_area.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_story_interactive_area.d.ts","sourceRoot":"","sources":["../../src/types/2_story_interactive_area.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAqB,KAAK,QAAQ,EAAsB,MAAM,iBAAiB,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAkB,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAE1D,gBAAgB;AAChB,MAAM,WAAW,4BAA4B;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,gBAAgB;AAChB,MAAM,WAAW,mCAAmC;IAClD,QAAQ,EAAE,4BAA4B,CAAC;CACxC;AAED,gBAAgB;AAChB,MAAM,WAAW,4BAA6B,SAAQ,mCAAmC;IACvF,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,gBAAgB;AAChB,MAAM,WAAW,yBAA0B,SAAQ,mCAAmC;IACpF,KAAK,EAAE,KAAK,CAAC;CACd;AAED,gBAAgB;AAChB,MAAM,WAAW,4BAA6B,SAAQ,mCAAmC;IACvF,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,gBAAgB;AAChB,MAAM,WAAW,2BAA4B,SAAQ,mCAAmC;IACtF,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAED,kCAAkC;AAClC,MAAM,MAAM,oBAAoB,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,4BAA4B,GAC5B,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"2_story_interactive_area.d.ts","sourceRoot":"","sources":["../../src/types/2_story_interactive_area.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM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Q,mCAAmC;IACtF,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gBAAgB;AAChB,MAAM,WAAW,wBAAyB,SAAQ,mCAAmC;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,kCAAkC;AAClC,MAAM,MAAM,oBAAoB,GAC5B,4BAA4B,GAC5B,yBAAyB,GACzB,4BAA4B,GAC5B,2BAA2B,GAC3B,wBAAwB,GACxB,2BAA2B,GAC3B,wBAAwB,CAAC;AAW7B,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,GAAG,CAAC,SAAS,GAAG,oBAAoB,CAqDvF;AAKD,wBAAgB,8BAA8B,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,UAAU,GAAG,GAAG,CAAC,SAAS,CA0C7G"}
|
|
@@ -43,15 +43,16 @@ function constructStoryInteractiveArea(area) {
|
|
|
43
43
|
(0, _0_deps_js_1.unreachable)(); // will this ever be empty?
|
|
44
44
|
}
|
|
45
45
|
const location = (0, _0_location_js_1.constructLocation)(area.geo);
|
|
46
|
-
return { position, location };
|
|
46
|
+
return { type: "location", position, location };
|
|
47
47
|
}
|
|
48
48
|
else if (_2_tl_js_1.Api.is("mediaAreaVenue", area)) {
|
|
49
49
|
const venue = (0, _1_venue_js_1.constructVenue)(area);
|
|
50
|
-
return { position, venue };
|
|
50
|
+
return { type: "venue", position, venue };
|
|
51
51
|
}
|
|
52
52
|
else if (_2_tl_js_1.Api.is("mediaAreaSuggestedReaction", area)) {
|
|
53
53
|
const reaction = (0, _0_reaction_js_1.constructReaction)(area.reaction);
|
|
54
54
|
return {
|
|
55
|
+
type: "reaction",
|
|
55
56
|
position,
|
|
56
57
|
reaction,
|
|
57
58
|
count: 0, // TODO: count
|
|
@@ -61,6 +62,7 @@ function constructStoryInteractiveArea(area) {
|
|
|
61
62
|
}
|
|
62
63
|
else if (_2_tl_js_1.Api.is("mediaAreaChannelPost", area)) {
|
|
63
64
|
return {
|
|
65
|
+
type: "messageReference",
|
|
64
66
|
position,
|
|
65
67
|
messageReference: {
|
|
66
68
|
chatId: _2_tl_js_1.Api.peerToChatId(area),
|
|
@@ -68,6 +70,29 @@ function constructStoryInteractiveArea(area) {
|
|
|
68
70
|
},
|
|
69
71
|
};
|
|
70
72
|
}
|
|
73
|
+
else if (_2_tl_js_1.Api.is("mediaAreaUrl", area)) {
|
|
74
|
+
return {
|
|
75
|
+
type: "link",
|
|
76
|
+
position,
|
|
77
|
+
link: area.url,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
else if (_2_tl_js_1.Api.is("mediaAreaWeather", area)) {
|
|
81
|
+
return {
|
|
82
|
+
type: "weather",
|
|
83
|
+
position,
|
|
84
|
+
emoji: area.emoji,
|
|
85
|
+
temperature: area.temperature_c,
|
|
86
|
+
color: area.color,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
else if (_2_tl_js_1.Api.is("mediaAreaStarGift", area)) {
|
|
90
|
+
return {
|
|
91
|
+
type: "gift",
|
|
92
|
+
position,
|
|
93
|
+
slug: area.slug,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
71
96
|
else {
|
|
72
97
|
(0, _0_deps_js_1.unreachable)();
|
|
73
98
|
}
|
|
@@ -77,36 +102,42 @@ function storyInteractiveAreaPositionToTlObject(position) {
|
|
|
77
102
|
}
|
|
78
103
|
function storyInteractiveAreaToTlObject(area, getPeer) {
|
|
79
104
|
const coordinates = storyInteractiveAreaPositionToTlObject(area.position);
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
else if ("venue" in area) {
|
|
85
|
-
const geo = { _: "geoPoint", lat: area.venue.location.latitude, long: area.venue.location.longitude, access_hash: 0n, accuracy_radius: area.venue.location.horizontalAccuracy };
|
|
86
|
-
return {
|
|
87
|
-
_: "mediaAreaVenue",
|
|
88
|
-
coordinates,
|
|
89
|
-
geo,
|
|
90
|
-
address: area.venue.address,
|
|
91
|
-
provider: "foursquare",
|
|
92
|
-
title: area.venue.title,
|
|
93
|
-
venue_id: area.venue.foursquareId || "",
|
|
94
|
-
venue_type: area.venue.foursquareType || "",
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
else if ("reaction" in area) {
|
|
98
|
-
const reaction = (0, _0_reaction_js_1.reactionToTlObject)(area.reaction);
|
|
99
|
-
return { _: "mediaAreaSuggestedReaction", coordinates, reaction, dark: area.isDark ? true : undefined, flipped: area.isFlipped ? true : undefined };
|
|
100
|
-
}
|
|
101
|
-
else if ("messageReference" in area) {
|
|
102
|
-
const peer = getPeer(_2_tl_js_1.Api.chatIdToPeer(area.messageReference.chatId));
|
|
103
|
-
if (!peer || peer[0].type !== "channel") {
|
|
104
|
-
(0, _0_deps_js_1.unreachable)();
|
|
105
|
+
switch (area.type) {
|
|
106
|
+
case "location": {
|
|
107
|
+
const geo = { _: "geoPoint", lat: area.location.latitude, long: area.location.longitude, access_hash: 0n, accuracy_radius: area.location.horizontalAccuracy };
|
|
108
|
+
return { _: "mediaAreaGeoPoint", coordinates, geo };
|
|
105
109
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
case "venue": {
|
|
111
|
+
const geo = { _: "geoPoint", lat: area.venue.location.latitude, long: area.venue.location.longitude, access_hash: 0n, accuracy_radius: area.venue.location.horizontalAccuracy };
|
|
112
|
+
return {
|
|
113
|
+
_: "mediaAreaVenue",
|
|
114
|
+
coordinates,
|
|
115
|
+
geo,
|
|
116
|
+
address: area.venue.address,
|
|
117
|
+
provider: "foursquare",
|
|
118
|
+
title: area.venue.title,
|
|
119
|
+
venue_id: area.venue.foursquareId || "",
|
|
120
|
+
venue_type: area.venue.foursquareType || "",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
case "reaction": {
|
|
124
|
+
const reaction = (0, _0_reaction_js_1.reactionToTlObject)(area.reaction);
|
|
125
|
+
return { _: "mediaAreaSuggestedReaction", coordinates, reaction, dark: area.isDark ? true : undefined, flipped: area.isFlipped ? true : undefined };
|
|
126
|
+
}
|
|
127
|
+
case "messageReference": {
|
|
128
|
+
const peer = getPeer(_2_tl_js_1.Api.chatIdToPeer(area.messageReference.chatId));
|
|
129
|
+
if (!peer || peer[0].type !== "channel") {
|
|
130
|
+
(0, _0_deps_js_1.unreachable)();
|
|
131
|
+
}
|
|
132
|
+
const channel = { _: "inputChannel", channel_id: (0, _2_telegram_js_1.chatIdToPeerId)(peer[0].id), access_hash: peer[1] };
|
|
133
|
+
return { _: "inputMediaAreaChannelPost", coordinates, channel, msg_id: area.messageReference.messageId };
|
|
134
|
+
}
|
|
135
|
+
case "link":
|
|
136
|
+
return { _: "mediaAreaUrl", coordinates, url: area.link };
|
|
137
|
+
case "weather":
|
|
138
|
+
return { _: "mediaAreaWeather", coordinates, emoji: area.emoji, temperature_c: area.temperature, color: area.color };
|
|
139
|
+
case "gift":
|
|
140
|
+
return { _: "mediaAreaStarGift", coordinates, slug: area.slug };
|
|
111
141
|
}
|
|
142
|
+
(0, _0_deps_js_1.unreachable)();
|
|
112
143
|
}
|