mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[store] hide nsfw content behind spoiler
This commit is contained in:
@@ -7,6 +7,7 @@ using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Service;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using Telegram.Bot.Types.ReplyMarkups;
|
||||
using West.TelegramBot.ContentStore.Service;
|
||||
@@ -113,13 +114,24 @@ public class Store : BotEventHandler
|
||||
|
||||
var randomMedia = await mediaService!.GetRandomMediaAsync();
|
||||
var file = randomMedia.File;
|
||||
|
||||
switch (randomMedia.Type)
|
||||
{
|
||||
case InputMediaType.Photo:
|
||||
await Bot.SendPhotoAsync(Chat.Id, file, 0, randomMedia.Caption, replyToMessageId: messageId, parseMode: ParseMode.Html);
|
||||
await Bot.SendPhotoAsync(Chat.Id, file,
|
||||
caption: randomMedia.Caption,
|
||||
replyToMessageId: messageId,
|
||||
parseMode: ParseMode.Html,
|
||||
hasSpoiler: randomMedia.Nsfw
|
||||
);
|
||||
break;
|
||||
case InputMediaType.Video:
|
||||
await Bot.SendVideoAsync(Chat.Id, file, caption: randomMedia.Caption, replyToMessageId: messageId, parseMode: ParseMode.Html);
|
||||
await Bot.SendVideoAsync(Chat.Id, file,
|
||||
caption: randomMedia.Caption,
|
||||
replyToMessageId: messageId,
|
||||
parseMode: ParseMode.Html,
|
||||
hasSpoiler: randomMedia.Nsfw
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user