@im-more/dsh-telegram 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/cordis.patch.yml +10 -0
- package/lib/index.js +2067 -0
- package/lib/index.js.map +1 -0
- package/lib/types/bot.d.ts +70 -0
- package/lib/types/bot.d.ts.map +1 -0
- package/lib/types/bot.js +231 -0
- package/lib/types/bot.js.map +1 -0
- package/lib/types/config.d.ts +34 -0
- package/lib/types/config.d.ts.map +1 -0
- package/lib/types/config.js +41 -0
- package/lib/types/config.js.map +1 -0
- package/lib/types/decode.d.ts +39 -0
- package/lib/types/decode.d.ts.map +1 -0
- package/lib/types/decode.js +382 -0
- package/lib/types/decode.js.map +1 -0
- package/lib/types/errors.d.ts +33 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +89 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/identity.d.ts +19 -0
- package/lib/types/identity.d.ts.map +1 -0
- package/lib/types/identity.js +34 -0
- package/lib/types/identity.js.map +1 -0
- package/lib/types/index.d.ts +10 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +8 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/media.d.ts +38 -0
- package/lib/types/media.d.ts.map +1 -0
- package/lib/types/media.js +65 -0
- package/lib/types/media.js.map +1 -0
- package/lib/types/modes/html.d.ts +16 -0
- package/lib/types/modes/html.d.ts.map +1 -0
- package/lib/types/modes/html.js +155 -0
- package/lib/types/modes/html.js.map +1 -0
- package/lib/types/modes/plain.d.ts +14 -0
- package/lib/types/modes/plain.d.ts.map +1 -0
- package/lib/types/modes/plain.js +56 -0
- package/lib/types/modes/plain.js.map +1 -0
- package/lib/types/modes/shared.d.ts +140 -0
- package/lib/types/modes/shared.d.ts.map +1 -0
- package/lib/types/modes/shared.js +405 -0
- package/lib/types/modes/shared.js.map +1 -0
- package/lib/types/polling.d.ts +26 -0
- package/lib/types/polling.d.ts.map +1 -0
- package/lib/types/polling.js +149 -0
- package/lib/types/polling.js.map +1 -0
- package/lib/types/request.d.ts +67 -0
- package/lib/types/request.d.ts.map +1 -0
- package/lib/types/request.js +158 -0
- package/lib/types/request.js.map +1 -0
- package/lib/types/secret.d.ts +27 -0
- package/lib/types/secret.d.ts.map +1 -0
- package/lib/types/secret.js +39 -0
- package/lib/types/secret.js.map +1 -0
- package/lib/types/send.d.ts +48 -0
- package/lib/types/send.d.ts.map +1 -0
- package/lib/types/send.js +326 -0
- package/lib/types/send.js.map +1 -0
- package/lib/types/types/game.d.ts +102 -0
- package/lib/types/types/game.d.ts.map +1 -0
- package/lib/types/types/game.js +5 -0
- package/lib/types/types/game.js.map +1 -0
- package/lib/types/types/index.d.ts +2751 -0
- package/lib/types/types/index.d.ts.map +1 -0
- package/lib/types/types/index.js +88 -0
- package/lib/types/types/index.js.map +1 -0
- package/lib/types/types/inline.d.ts +796 -0
- package/lib/types/types/inline.d.ts.map +1 -0
- package/lib/types/types/inline.js +4 -0
- package/lib/types/types/inline.js.map +1 -0
- package/lib/types/types/internal.d.ts +32 -0
- package/lib/types/types/internal.d.ts.map +1 -0
- package/lib/types/types/internal.js +30 -0
- package/lib/types/types/internal.js.map +1 -0
- package/lib/types/types/passport.d.ts +229 -0
- package/lib/types/types/passport.d.ts.map +1 -0
- package/lib/types/types/passport.js +3 -0
- package/lib/types/types/passport.js.map +1 -0
- package/lib/types/types/payment.d.ts +285 -0
- package/lib/types/types/payment.d.ts.map +1 -0
- package/lib/types/types/payment.js +6 -0
- package/lib/types/types/payment.js.map +1 -0
- package/lib/types/types/sticker.d.ts +221 -0
- package/lib/types/types/sticker.d.ts.map +1 -0
- package/lib/types/types/sticker.js +11 -0
- package/lib/types/types/sticker.js.map +1 -0
- package/lib/types/types/update.d.ts +97 -0
- package/lib/types/types/update.d.ts.map +1 -0
- package/lib/types/types/update.js +6 -0
- package/lib/types/types/update.js.map +1 -0
- package/lib/types/webhook.d.ts +29 -0
- package/lib/types/webhook.d.ts.map +1 -0
- package/lib/types/webhook.js +129 -0
- package/lib/types/webhook.js.map +1 -0
- package/package.json +61 -3
- package/src/bot.ts +349 -0
- package/src/config.ts +73 -0
- package/src/decode.ts +472 -0
- package/src/errors.ts +103 -0
- package/src/identity.ts +41 -0
- package/src/index.ts +14 -0
- package/src/media.ts +79 -0
- package/src/modes/html.ts +193 -0
- package/src/modes/plain.ts +75 -0
- package/src/modes/shared.ts +505 -0
- package/src/polling.ts +176 -0
- package/src/request.ts +224 -0
- package/src/secret.ts +46 -0
- package/src/send.ts +454 -0
- package/src/types/.eslintrc.yml +2 -0
- package/src/types/game.ts +112 -0
- package/src/types/index.ts +3028 -0
- package/src/types/inline.ts +857 -0
- package/src/types/internal.ts +64 -0
- package/src/types/passport.ts +256 -0
- package/src/types/payment.ts +304 -0
- package/src/types/sticker.ts +244 -0
- package/src/types/update.ts +107 -0
- package/src/webhook.ts +168 -0
- package/README.md +0 -3
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { PlatformError, } from '@deepseek-ai/cordis-plugin-im-core';
|
|
2
|
+
import { classifyTelegramError, isNotModified } from "./errors.js";
|
|
3
|
+
/** Telegram method for one single-media payload. */
|
|
4
|
+
function sendMethod(kind) {
|
|
5
|
+
switch (kind) {
|
|
6
|
+
case 'photo':
|
|
7
|
+
return 'sendPhoto';
|
|
8
|
+
case 'video':
|
|
9
|
+
return 'sendVideo';
|
|
10
|
+
case 'audio':
|
|
11
|
+
return 'sendAudio';
|
|
12
|
+
case 'animation':
|
|
13
|
+
return 'sendAnimation';
|
|
14
|
+
default:
|
|
15
|
+
return 'sendDocument';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Multipart field name of one media kind. */
|
|
19
|
+
function mediaField(kind) {
|
|
20
|
+
switch (kind) {
|
|
21
|
+
case 'photo':
|
|
22
|
+
return 'photo';
|
|
23
|
+
case 'video':
|
|
24
|
+
return 'video';
|
|
25
|
+
case 'audio':
|
|
26
|
+
return 'audio';
|
|
27
|
+
case 'animation':
|
|
28
|
+
return 'animation';
|
|
29
|
+
default:
|
|
30
|
+
return 'document';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** The inline keyboard a payload carries, if any. */
|
|
34
|
+
function markupOf(payload) {
|
|
35
|
+
return payload.buttons === undefined
|
|
36
|
+
? undefined
|
|
37
|
+
: { inline_keyboard: payload.buttons };
|
|
38
|
+
}
|
|
39
|
+
/** Put the fields every send request shares into a multipart form. */
|
|
40
|
+
function appendCommon(form, payload, threadId) {
|
|
41
|
+
form.set('chat_id', payload.chatId);
|
|
42
|
+
if (threadId !== undefined)
|
|
43
|
+
form.set('message_thread_id', String(threadId));
|
|
44
|
+
if (payload.replyTo !== undefined) {
|
|
45
|
+
form.set('reply_parameters', JSON.stringify({
|
|
46
|
+
message_id: payload.replyTo,
|
|
47
|
+
allow_sending_without_reply: true,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
if (payload.caption !== undefined && payload.caption !== '') {
|
|
51
|
+
form.set('caption', payload.caption);
|
|
52
|
+
if (payload.parseMode !== undefined)
|
|
53
|
+
form.set('parse_mode', payload.parseMode);
|
|
54
|
+
}
|
|
55
|
+
const markup = markupOf(payload);
|
|
56
|
+
if (markup !== undefined)
|
|
57
|
+
form.set('reply_markup', JSON.stringify(markup));
|
|
58
|
+
}
|
|
59
|
+
/** Wrap staged bytes in a named blob for multipart upload. */
|
|
60
|
+
function blobOf(staged) {
|
|
61
|
+
return new Blob([staged.data], staged.mime === undefined ? {} : { type: staged.mime });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* The published part of one sent message.
|
|
65
|
+
*
|
|
66
|
+
* @param message - the Telegram message the send answered with.
|
|
67
|
+
* @param mediaKeys - staged media keys the request carried, when it carried media.
|
|
68
|
+
* @returns the part, with the media keys recorded in `raw` for a later edit check.
|
|
69
|
+
*/
|
|
70
|
+
function partOf(message, mediaKeys) {
|
|
71
|
+
const id = message.message_id;
|
|
72
|
+
// The request already reached the platform, so an answer without an id is a published outcome, not a refusal.
|
|
73
|
+
if (id === undefined)
|
|
74
|
+
throw new PlatformError('invalid', 'telegram: the Bot API answered without a message id', { published: 'unknown' });
|
|
75
|
+
return {
|
|
76
|
+
id: String(id),
|
|
77
|
+
kind: 'message',
|
|
78
|
+
time: message.date === undefined ? Date.now() : message.date * 1000,
|
|
79
|
+
...(message.message_thread_id === undefined
|
|
80
|
+
? {}
|
|
81
|
+
: { thread: { id: String(message.message_thread_id) } }),
|
|
82
|
+
...(mediaKeys === undefined ? {} : { raw: { mediaKeys } }),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** Media keys recorded in `SentPart.raw` by {@link partOf}, absent on a handle rebuilt after a restart. */
|
|
86
|
+
function recordedMediaKeys(part) {
|
|
87
|
+
const raw = part.raw;
|
|
88
|
+
if (typeof raw !== 'object' || raw === null || !('mediaKeys' in raw))
|
|
89
|
+
return undefined;
|
|
90
|
+
const keys = raw.mediaKeys;
|
|
91
|
+
return Array.isArray(keys) ? keys : undefined;
|
|
92
|
+
}
|
|
93
|
+
/** Whether an edit still targets the media the part was published with. */
|
|
94
|
+
function sameMediaKeys(a, b) {
|
|
95
|
+
return a.length === b.length && a.every((key, index) => key === b[index]);
|
|
96
|
+
}
|
|
97
|
+
/** Look one staged media item up, failing before any request when it expired. */
|
|
98
|
+
function stagedOf(deps, key) {
|
|
99
|
+
const staged = deps.staging.get(key);
|
|
100
|
+
if (staged === undefined) {
|
|
101
|
+
throw new PlatformError('invalid', 'telegram: the staged media bytes expired before send; nothing was published', {
|
|
102
|
+
published: 'no',
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return staged;
|
|
106
|
+
}
|
|
107
|
+
/** Thread id carried by an adapter referrer, when the target asks to follow it. */
|
|
108
|
+
function referrerThread(referrer) {
|
|
109
|
+
if (typeof referrer !== 'object' ||
|
|
110
|
+
referrer === null ||
|
|
111
|
+
!('threadId' in referrer))
|
|
112
|
+
return undefined;
|
|
113
|
+
const value = referrer.threadId;
|
|
114
|
+
return typeof value === 'string' && /^\d+$/.test(value)
|
|
115
|
+
? Number(value)
|
|
116
|
+
: undefined;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Send one serialized payload.
|
|
120
|
+
*
|
|
121
|
+
* @param deps - adapter services.
|
|
122
|
+
* @param payload - the serialized draft.
|
|
123
|
+
* @param target - the chat (and thread) the payload goes to.
|
|
124
|
+
* @param ctx - core send context (signal, part index).
|
|
125
|
+
* @returns the published part.
|
|
126
|
+
*/
|
|
127
|
+
export async function sendPayload(deps, payload, target, ctx) {
|
|
128
|
+
const signal = ctx.options.signal;
|
|
129
|
+
const markup = markupOf(payload);
|
|
130
|
+
const threadId = payload.threadId ??
|
|
131
|
+
(target.thread === true ? referrerThread(target.referrer) : undefined);
|
|
132
|
+
if (payload.kind === 'text') {
|
|
133
|
+
const linkPreview = deps.config.linkPreview
|
|
134
|
+
? {}
|
|
135
|
+
: { link_preview_options: { is_disabled: true } };
|
|
136
|
+
const message = await deps.internal.sendMessage({
|
|
137
|
+
chat_id: payload.chatId,
|
|
138
|
+
text: payload.text ?? '',
|
|
139
|
+
...(payload.parseMode === undefined
|
|
140
|
+
? {}
|
|
141
|
+
: { parse_mode: payload.parseMode }),
|
|
142
|
+
...(threadId === undefined ? {} : { message_thread_id: threadId }),
|
|
143
|
+
...(payload.replyTo === undefined
|
|
144
|
+
? {}
|
|
145
|
+
: {
|
|
146
|
+
reply_parameters: {
|
|
147
|
+
message_id: payload.replyTo,
|
|
148
|
+
allow_sending_without_reply: true,
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
...(markup === undefined ? {} : { reply_markup: markup }),
|
|
152
|
+
...linkPreview,
|
|
153
|
+
}, signal);
|
|
154
|
+
return partOf(message);
|
|
155
|
+
}
|
|
156
|
+
const items = payload.media ?? [];
|
|
157
|
+
const first = items[0];
|
|
158
|
+
if (first === undefined)
|
|
159
|
+
throw new PlatformError('invalid', 'telegram: media payload without media', { published: 'no' });
|
|
160
|
+
if (payload.kind === 'album') {
|
|
161
|
+
const form = new FormData();
|
|
162
|
+
const media = items.map((item, index) => {
|
|
163
|
+
form.append(`file${index}`, blobOf(stagedOf(deps, item.key)), item.name || `file${index}`);
|
|
164
|
+
return {
|
|
165
|
+
type: item.kind,
|
|
166
|
+
media: `attach://file${index}`,
|
|
167
|
+
...(index !== 0 ||
|
|
168
|
+
payload.caption === undefined ||
|
|
169
|
+
payload.caption === ''
|
|
170
|
+
? {}
|
|
171
|
+
: {
|
|
172
|
+
caption: payload.caption,
|
|
173
|
+
...(payload.parseMode === undefined
|
|
174
|
+
? {}
|
|
175
|
+
: { parse_mode: payload.parseMode }),
|
|
176
|
+
}),
|
|
177
|
+
};
|
|
178
|
+
});
|
|
179
|
+
// `sendMediaGroup` accepts no caption, parse_mode or reply_markup fields: the
|
|
180
|
+
// caption rides the first media item.
|
|
181
|
+
form.set('chat_id', payload.chatId);
|
|
182
|
+
if (threadId !== undefined)
|
|
183
|
+
form.set('message_thread_id', String(threadId));
|
|
184
|
+
if (payload.replyTo !== undefined) {
|
|
185
|
+
form.set('reply_parameters', JSON.stringify({
|
|
186
|
+
message_id: payload.replyTo,
|
|
187
|
+
allow_sending_without_reply: true,
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
form.set('media', JSON.stringify(media));
|
|
191
|
+
const messages = await deps.sendMediaGroup(form, signal);
|
|
192
|
+
const head = messages[0];
|
|
193
|
+
if (head === undefined)
|
|
194
|
+
throw new PlatformError('invalid', 'telegram: sendMediaGroup returned no messages');
|
|
195
|
+
const part = partOf(head, items.map((item) => item.key));
|
|
196
|
+
// `partOf` refused an answer without an id, so the head carries one.
|
|
197
|
+
const headId = head.message_id;
|
|
198
|
+
const aliases = messages
|
|
199
|
+
.slice(1)
|
|
200
|
+
.flatMap((message) => message.message_id === undefined ? [] : [String(message.message_id)]);
|
|
201
|
+
// An album carries no keyboard, so a keyboard message answers its first item instead of being dropped.
|
|
202
|
+
if (payload.buttons !== undefined && payload.buttons.length > 0) {
|
|
203
|
+
let keyboard;
|
|
204
|
+
try {
|
|
205
|
+
keyboard = await deps.internal.sendMessage({
|
|
206
|
+
chat_id: payload.chatId,
|
|
207
|
+
// The caption already rides the first album item; the keyboard message carries no body of its own.
|
|
208
|
+
text: '\u2060',
|
|
209
|
+
...(payload.parseMode === undefined
|
|
210
|
+
? {}
|
|
211
|
+
: { parse_mode: payload.parseMode }),
|
|
212
|
+
...(threadId === undefined ? {} : { message_thread_id: threadId }),
|
|
213
|
+
reply_parameters: {
|
|
214
|
+
message_id: headId,
|
|
215
|
+
allow_sending_without_reply: true,
|
|
216
|
+
},
|
|
217
|
+
reply_markup: { inline_keyboard: payload.buttons },
|
|
218
|
+
}, signal);
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
// The album is already on the platform, so the outcome is unknown even when Telegram refused the keyboard.
|
|
222
|
+
const cause = classifyTelegramError(error);
|
|
223
|
+
throw new PlatformError(cause.kind, cause.message, {
|
|
224
|
+
...(cause.code === undefined ? {} : { code: cause.code }),
|
|
225
|
+
...(cause.retryAfterMs === undefined
|
|
226
|
+
? {}
|
|
227
|
+
: { retryAfterMs: cause.retryAfterMs }),
|
|
228
|
+
published: 'unknown',
|
|
229
|
+
cause,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
aliases.push(String(keyboard.message_id));
|
|
233
|
+
}
|
|
234
|
+
return aliases.length === 0 ? part : { ...part, aliases };
|
|
235
|
+
}
|
|
236
|
+
const form = new FormData();
|
|
237
|
+
appendCommon(form, payload, threadId);
|
|
238
|
+
form.append(mediaField(first.kind), blobOf(stagedOf(deps, first.key)), first.name || 'file');
|
|
239
|
+
const message = await deps.sendMedia(sendMethod(first.kind), form, signal);
|
|
240
|
+
return partOf(message, [first.key]);
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Edit one published message in place.
|
|
244
|
+
*
|
|
245
|
+
* Text messages use `editMessageText`; media messages edit their caption. An
|
|
246
|
+
* edit cannot replace the media, and a caption edit without a caption or a
|
|
247
|
+
* keyboard would publish nothing, so both are refused for the caller to
|
|
248
|
+
* withdraw and resend.
|
|
249
|
+
*
|
|
250
|
+
* @param deps - adapter services.
|
|
251
|
+
* @param part - the published part.
|
|
252
|
+
* @param payload - the freshly serialized draft.
|
|
253
|
+
* @param handle - the message handle (carries the target chat).
|
|
254
|
+
* @param signal - cancellation.
|
|
255
|
+
*/
|
|
256
|
+
export async function editPayload(deps, part, payload, handle, signal) {
|
|
257
|
+
const messageId = Number(part.id);
|
|
258
|
+
if (!Number.isSafeInteger(messageId)) {
|
|
259
|
+
throw new PlatformError('invalid', `telegram: "${part.id}" is not a Telegram message id`);
|
|
260
|
+
}
|
|
261
|
+
const markup = payload.buttons === undefined
|
|
262
|
+
? { inline_keyboard: [] }
|
|
263
|
+
: { inline_keyboard: payload.buttons };
|
|
264
|
+
try {
|
|
265
|
+
if (payload.kind === 'text') {
|
|
266
|
+
await deps.internal.editMessageText({
|
|
267
|
+
chat_id: handle.target.chat.id,
|
|
268
|
+
message_id: messageId,
|
|
269
|
+
text: payload.text ?? '',
|
|
270
|
+
...(payload.parseMode === undefined
|
|
271
|
+
? {}
|
|
272
|
+
: { parse_mode: payload.parseMode }),
|
|
273
|
+
reply_markup: markup,
|
|
274
|
+
...(deps.config.linkPreview
|
|
275
|
+
? {}
|
|
276
|
+
: { link_preview_options: { is_disabled: true } }),
|
|
277
|
+
}, signal);
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const caption = payload.caption ?? '';
|
|
281
|
+
const recorded = recordedMediaKeys(part);
|
|
282
|
+
if (recorded !== undefined) {
|
|
283
|
+
const edited = (payload.media ?? []).map((item) => item.key);
|
|
284
|
+
if (!sameMediaKeys(recorded, edited)) {
|
|
285
|
+
throw new PlatformError('invalid', 'telegram: an edit cannot replace media; withdraw and resend the message instead', { published: 'no' });
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
// Telegram has no empty-caption edit: an empty caption with no keyboard would silently do nothing.
|
|
289
|
+
if (caption === '' &&
|
|
290
|
+
(payload.buttons === undefined || payload.buttons.length === 0)) {
|
|
291
|
+
throw new PlatformError('invalid', 'telegram: a media edit needs a caption or a keyboard; withdraw and resend the message instead', { published: 'no' });
|
|
292
|
+
}
|
|
293
|
+
await deps.internal.editMessageCaption({
|
|
294
|
+
chat_id: handle.target.chat.id,
|
|
295
|
+
message_id: messageId,
|
|
296
|
+
caption,
|
|
297
|
+
...(payload.parseMode === undefined
|
|
298
|
+
? {}
|
|
299
|
+
: { parse_mode: payload.parseMode }),
|
|
300
|
+
reply_markup: markup,
|
|
301
|
+
}, signal);
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
if (isNotModified(error))
|
|
305
|
+
return;
|
|
306
|
+
throw error;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Delete one published message.
|
|
311
|
+
*
|
|
312
|
+
* @param deps - adapter services.
|
|
313
|
+
* @param part - the published part.
|
|
314
|
+
* @param handle - the message handle (carries the target chat).
|
|
315
|
+
*/
|
|
316
|
+
export async function deletePart(deps, part, handle) {
|
|
317
|
+
const messageId = Number(part.id);
|
|
318
|
+
if (!Number.isSafeInteger(messageId)) {
|
|
319
|
+
throw new PlatformError('invalid', `telegram: "${part.id}" is not a Telegram message id`);
|
|
320
|
+
}
|
|
321
|
+
await deps.internal.deleteMessage({
|
|
322
|
+
chat_id: handle.target.chat.id,
|
|
323
|
+
message_id: messageId,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
//# sourceMappingURL=send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/send.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,GAKd,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,qBAAqB,EAAE,aAAa,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EACtB,IAAc,EACd,MAAqB;IAErB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,aAAa,CACrB,SAAS,EACT,cAAc,IAAI,CAAC,EAAE,gCAAgC,CACtD,CAAA;IACH,CAAC;IACD,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC;QAChC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC9B,UAAU,EAAE,SAAS;KACtB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Animation, InlineKeyboardMarkup, Integer, Message, MessageEntity, PhotoSize, User } from './index.ts';
|
|
2
|
+
export interface SendGamePayload {
|
|
3
|
+
/** Unique identifier for the target chat */
|
|
4
|
+
chat_id?: Integer;
|
|
5
|
+
/** Unique identifier for the target message thread (topic) of the forum; for forum supergroups only */
|
|
6
|
+
message_thread_id?: number;
|
|
7
|
+
/** Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather. */
|
|
8
|
+
game_short_name?: string;
|
|
9
|
+
/** Sends the message silently. Users will receive a notification with no sound. */
|
|
10
|
+
disable_notification?: boolean;
|
|
11
|
+
/** Protects the contents of the sent message from forwarding and saving */
|
|
12
|
+
protect_content?: boolean;
|
|
13
|
+
/** If the message is a reply, ID of the original message */
|
|
14
|
+
reply_to_message_id?: Integer;
|
|
15
|
+
/** Pass True, if the message should be sent even if the specified replied-to message is not found */
|
|
16
|
+
allow_sending_without_reply?: boolean;
|
|
17
|
+
/** A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' button will be shown. If not empty, the first button must launch the game. */
|
|
18
|
+
reply_markup?: InlineKeyboardMarkup;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
|
|
22
|
+
* @see https://core.telegram.org/bots/api#game
|
|
23
|
+
*/
|
|
24
|
+
export interface Game {
|
|
25
|
+
/** Title of the game */
|
|
26
|
+
title?: string;
|
|
27
|
+
/** Description of the game */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Photo that will be displayed in the game message in chats. */
|
|
30
|
+
photo?: PhotoSize[];
|
|
31
|
+
/** Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters. */
|
|
32
|
+
text?: string;
|
|
33
|
+
/** Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc. */
|
|
34
|
+
text_entities?: MessageEntity[];
|
|
35
|
+
/** Optional. Animation that will be displayed in the game message in chats. Upload via BotFather */
|
|
36
|
+
animation?: Animation;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A placeholder, currently holds no information. Use BotFather to set up your game.
|
|
40
|
+
* @see https://core.telegram.org/bots/api#callbackgame
|
|
41
|
+
*/
|
|
42
|
+
export type CallbackGame = any;
|
|
43
|
+
export interface SetGameScorePayload {
|
|
44
|
+
/** User identifier */
|
|
45
|
+
user_id?: Integer;
|
|
46
|
+
/** New score, must be non-negative */
|
|
47
|
+
score?: Integer;
|
|
48
|
+
/** Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters */
|
|
49
|
+
force?: boolean;
|
|
50
|
+
/** Pass True, if the game message should not be automatically edited to include the current scoreboard */
|
|
51
|
+
disable_edit_message?: boolean;
|
|
52
|
+
/** Required if inline_message_id is not specified. Unique identifier for the target chat */
|
|
53
|
+
chat_id?: Integer;
|
|
54
|
+
/** Required if inline_message_id is not specified. Identifier of the sent message */
|
|
55
|
+
message_id?: Integer;
|
|
56
|
+
/** Required if chat_id and message_id are not specified. Identifier of the inline message */
|
|
57
|
+
inline_message_id?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface GetGameHighScoresPayload {
|
|
60
|
+
/** Target user id */
|
|
61
|
+
user_id?: Integer;
|
|
62
|
+
/** Required if inline_message_id is not specified. Unique identifier for the target chat */
|
|
63
|
+
chat_id?: Integer;
|
|
64
|
+
/** Required if inline_message_id is not specified. Identifier of the sent message */
|
|
65
|
+
message_id?: Integer;
|
|
66
|
+
/** Required if chat_id and message_id are not specified. Identifier of the inline message */
|
|
67
|
+
inline_message_id?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* This object represents one row of the high scores table for a game.
|
|
71
|
+
* @see https://core.telegram.org/bots/api#gamehighscore
|
|
72
|
+
*/
|
|
73
|
+
export interface GameHighScore {
|
|
74
|
+
/** Position in high score table for the game */
|
|
75
|
+
position?: Integer;
|
|
76
|
+
/** User */
|
|
77
|
+
user?: User;
|
|
78
|
+
/** Score */
|
|
79
|
+
score?: Integer;
|
|
80
|
+
}
|
|
81
|
+
declare module './internal.ts' {
|
|
82
|
+
interface Internal {
|
|
83
|
+
/**
|
|
84
|
+
* Use this method to send a game. On success, the sent Message is returned.
|
|
85
|
+
* @see https://core.telegram.org/bots/api#sendgame
|
|
86
|
+
*/
|
|
87
|
+
sendGame(payload: SendGamePayload): Promise<Message>;
|
|
88
|
+
/**
|
|
89
|
+
* Use this method to set the score of the specified user in a game message. On success, if the message is not an inline message, the Message is returned, otherwise True is returned. Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
|
|
90
|
+
* @see https://core.telegram.org/bots/api#setgamescore
|
|
91
|
+
*/
|
|
92
|
+
setGameScore(payload: SetGameScorePayload): Promise<Message | boolean>;
|
|
93
|
+
/**
|
|
94
|
+
* Use this method to get data for high score tables. Will return the score of the specified user and several of their neighbors in a game. On success, returns an GameHighScore objects.
|
|
95
|
+
*
|
|
96
|
+
* This method will currently return scores for the target user, plus two of their closest neighbors on each side. Will also return the top three users if the user and his neighbors are not among them. Please note that this behavior is subject to change.
|
|
97
|
+
* @see https://core.telegram.org/bots/api#getgamehighscores
|
|
98
|
+
*/
|
|
99
|
+
getGameHighScores(payload: GetGameHighScoresPayload): Promise<GameHighScore>;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=game.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../../src/types/game.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,OAAO,EAAY,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAExH,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,uGAAuG;IACvG,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,6GAA6G;IAC7G,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,mFAAmF;IACnF,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,2EAA2E;IAC3E,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qGAAqG;IACrG,2BAA2B,CAAC,EAAE,OAAO,CAAA;IACrC,kKAAkK;IAClK,YAAY,CAAC,EAAE,oBAAoB,CAAA;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,wBAAwB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iEAAiE;IACjE,KAAK,CAAC,EAAE,SAAS,EAAE,CAAA;IACnB,iQAAiQ;IACjQ,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kGAAkG;IAClG,aAAa,CAAC,EAAE,aAAa,EAAE,CAAA;IAC/B,oGAAoG;IACpG,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,GAAG,CAAA;AAE9B,MAAM,WAAW,mBAAmB;IAClC,sBAAsB;IACt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