Skip to content

Commit

Permalink
fix +file can send mediagroup bug
Browse files Browse the repository at this point in the history
  • Loading branch information
makeding committed Jul 18, 2024
1 parent f9c1475 commit bb3dfcd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ async function tg_sender(ctx) {
has_spoiler: ctx.us.spoiler,
// show_caption_above_media: ctx.us.caption_above
}
if (mgs.length > 0) {
if (mgs.length > 0 && !ctx.us.asfile) {
if (ctx.us.telegraph) {
// when not have title provided and 1 illust only
if(!ctx.us.telegraph_title && illusts.length === 1) {
Expand Down
10 changes: 8 additions & 2 deletions handlers/telegram/pre_handle.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ export async function read_user_setting(bot, ctx) {
caption_extraction: us(d_f, ctx.text,'caption_extraction',['caption']),
caption_above: us(d_f, ctx.text,'caption_above',['above']),
// can't use switch_inline_query in a channel chat, because a user will not be able to use the button without knowing bot's username
share: ctx.type === 'channel' ? false : us(d_f, ctx.text,'share'),
share: us(d_f, ctx.text,'share'),
// dirty but work
remove_keyboard: us(d_f, ctx.text.replaceAll('+','\uff69').replaceAll('-','+').replaceAll('\uff69','-'),'remove_keyboard',['kb']),
remove_caption: us(d_f, ctx.text.replaceAll('+','\uff69').replaceAll('-','+').replaceAll('\uff69','-'),'remove_caption',['cp']),
// inline mode doesn't support mediagroup single_caption mode is useless
single_caption: ctx.inlineQuery ? false : us(d_f, ctx.text,'single_caption',['sc']),
single_caption: us(d_f, ctx.text,'single_caption',['sc']),
show_id: us(d_f, ctx.text,'show_id',['id']),
// caption end
// send as mediagroup when a illust with multiple images
Expand Down Expand Up @@ -221,6 +221,12 @@ export async function read_user_setting(bot, ctx) {
if (ctx.us.remove_keyboard) {
ctx.us.open = ctx.us.share = false
}
if (ctx.us.append_file){
ctx.us.asfile = false
}
if (ctx.type === 'channel'){
ctx.us.share = false
}
if(ctx.type === 'inline'){
ctx.us.single_caption = false
}
Expand Down

0 comments on commit bb3dfcd

Please sign in to comment.