mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
initial chat options implementation
This commit is contained in:
@@ -12,20 +12,23 @@ using Kruzya.TelegramBot.Core.Service;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using West.Entertainment.Options;
|
||||
|
||||
namespace West.Entertainment.Handler
|
||||
{
|
||||
public class Common : BotEventHandler
|
||||
{
|
||||
private readonly UserService _userService;
|
||||
private readonly NsfwOption _nsfwOption;
|
||||
private readonly ILogger _logger;
|
||||
private readonly CoreContext _db;
|
||||
|
||||
public Common(CoreContext db, ILogger<Common> logger, UserService userService)
|
||||
public Common(CoreContext db, ILogger<Common> logger, UserService userService, NsfwOption nsfwOption)
|
||||
{
|
||||
_db = db;
|
||||
_logger = logger;
|
||||
_userService = userService;
|
||||
_nsfwOption = nsfwOption;
|
||||
}
|
||||
|
||||
[Command(InChat.Public, "cooldowns", CommandParseMode.Both)]
|
||||
@@ -59,5 +62,20 @@ namespace West.Entertainment.Handler
|
||||
|
||||
await Bot.SendTextMessageAsync(Chat.Id, msg.ToString(), parseMode: ParseMode.Html);
|
||||
}
|
||||
|
||||
[Command("test_option_get")]
|
||||
public async Task HandleTestOptionGet()
|
||||
{
|
||||
await Bot.SendTextMessageAsync(Chat.Id, $"nsfw option is: {await _nsfwOption.GetValueAsync(Chat.Id)}");
|
||||
}
|
||||
|
||||
[Command("test_option_set")]
|
||||
public async Task HandleTestOptionSet()
|
||||
{
|
||||
var value = await _nsfwOption.GetValueAsync(Chat.Id);
|
||||
await _nsfwOption.SetValueAsync(Chat.Id, !value);
|
||||
|
||||
await Bot.SendTextMessageAsync(Chat.Id, $"nsfw option is: {await _nsfwOption.GetValueAsync(Chat.Id)}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user