Skip to content
Snippets Groups Projects
Verified Commit 4e66ec47 authored by Adrian Paschkowski's avatar Adrian Paschkowski :thinking:
Browse files

Support telegram captions and incremental content

parent 5eeef2dc
No related branches found
No related tags found
No related merge requests found
......@@ -67,14 +67,16 @@ export class TelegramService implements OnModuleInit {
const message = ctx.message ?? ctx.editedMessage;
const content = message.text;
const content = message.text ?? message.caption;
const location = message.location;
const image = message?.photo?.reduce((prev, curr) => {
if (prev.width > curr.width) return prev;
else return curr;
});
const entry: TelegramEntry = { content };
const entry: TelegramEntry = this.entries.get(ctx.from.id) ?? {
content,
};
if (image)
entry.photo = {
......@@ -232,16 +234,6 @@ export class TelegramService implements OnModuleInit {
const data = this.entries.get(ctx.from.id);
if (!data) return;
if (ctx.update?.callback_query?.message?.message_id)
await ctx.telegram.editMessageReplyMarkup(
ctx.from.id,
ctx.update.callback_query.message.message_id,
undefined,
'',
);
this.entries.delete(ctx.from.id);
let image_id: string | undefined;
if (data.photo) {
image_id = uuid();
......@@ -280,6 +272,16 @@ export class TelegramService implements OnModuleInit {
onEntryUpdate: entry,
});
this.entries.delete(ctx.from.id);
if (ctx.update?.callback_query?.message?.message_id)
await ctx.telegram.editMessageReplyMarkup(
ctx.from.id,
ctx.update.callback_query.message.message_id,
undefined,
'',
);
await ctx.reply(`✅ ${isPrivate ? 'Private' : 'Public'} Entry created`);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment