too many changes
This commit is contained in:
@@ -43,28 +43,42 @@ public sealed class InlineQueryHandler
|
||||
{
|
||||
var id = item.Id.ToString();
|
||||
|
||||
var tagsLine = item.Tags.Count > 0
|
||||
? string.Join(" ", item.Tags.Take(5).Select(t => "#" + t))
|
||||
: null;
|
||||
|
||||
return item.MediaType switch
|
||||
{
|
||||
MediaType.Photo => new InlineQueryResultCachedPhoto(id, item.FileId!)
|
||||
{
|
||||
Caption = item.Caption,
|
||||
Title = item.InlineTitle,
|
||||
Description = item.InlineDescription ?? tagsLine,
|
||||
},
|
||||
|
||||
MediaType.Video => new InlineQueryResultCachedVideo(id, item.FileId!, item.Caption ?? "Video"),
|
||||
MediaType.Video => new InlineQueryResultCachedVideo(
|
||||
id,
|
||||
item.FileId!,
|
||||
title: item.InlineTitle ?? item.Caption ?? "Video")
|
||||
{
|
||||
Caption = item.Caption,
|
||||
Description = item.InlineDescription ?? tagsLine,
|
||||
},
|
||||
|
||||
MediaType.Sticker => new InlineQueryResultCachedSticker(id, item.FileId!),
|
||||
|
||||
MediaType.Animation => new InlineQueryResultCachedMpeg4Gif(id, item.FileId!)
|
||||
{
|
||||
Caption = item.Caption,
|
||||
Title = item.InlineTitle,
|
||||
},
|
||||
|
||||
MediaType.Text => new InlineQueryResultArticle(
|
||||
id,
|
||||
title: item.Caption?[..Math.Min(60, item.Caption.Length)] ?? "Текст",
|
||||
title: item.InlineTitle ?? item.Caption?[..Math.Min(60, item.Caption.Length)] ?? "Текст",
|
||||
inputMessageContent: new InputTextMessageContent(item.Caption ?? ""))
|
||||
{
|
||||
Description = string.Join(" ", item.Tags.Take(5).Select(t => "#" + t)),
|
||||
Description = item.InlineDescription ?? tagsLine,
|
||||
},
|
||||
|
||||
_ => null
|
||||
|
||||
Reference in New Issue
Block a user