mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Do not parse sticker pack when removing from ban
Also added try-catch strategy when printing banned packs
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
#nullable enable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Utils;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
@@ -30,9 +32,9 @@ public partial class BanStickerSet
|
||||
return await Db.UserValues.FindOrCreateOption(Chat.Id, "cmBannedStickers");
|
||||
}
|
||||
|
||||
public async Task<bool> PreCommand(ParamParser.StickerSet.Param stickerSetParam)
|
||||
public async Task<bool> PreCommand(ParamParser.StickerSet.Param? stickerSetParam = null)
|
||||
{
|
||||
if (!stickerSetParam.IsValid)
|
||||
if (stickerSetParam != null && !stickerSetParam.IsValid)
|
||||
{
|
||||
await Reply("Неверный набор стикеров.");
|
||||
return false;
|
||||
@@ -42,13 +44,17 @@ public partial class BanStickerSet
|
||||
}
|
||||
|
||||
public string FormatStickerSetAction(StickerSet stickerSet, string action)
|
||||
{
|
||||
return new HtmlString()
|
||||
=> FormatStickerSetAction(stickerSet.Name, stickerSet.Title, action);
|
||||
|
||||
public string FormatStickerSetAction(string name, string action)
|
||||
=> FormatStickerSetAction(name, name, action);
|
||||
|
||||
public string FormatStickerSetAction(string name, string title, string action)
|
||||
=> new HtmlString()
|
||||
.Text("Набор стикеров ")
|
||||
.Url($"https://t.me/addstickers/{stickerSet.Name}", stickerSet.Title)
|
||||
.Url($"https://t.me/addstickers/{name}", title)
|
||||
.Text($" {action}.")
|
||||
.ToString();
|
||||
}
|
||||
|
||||
private async Task<bool> CanUseCommands()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user