mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Whois command. Some refactorings.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#nullable enable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
namespace West.TelegramBot.ChatManagement.Handler
|
||||
{
|
||||
public class Reputation : ManagementHandler
|
||||
{
|
||||
public Reputation(CoreContext db) : base(db) {}
|
||||
|
||||
[Command("whois", CommandParseMode.Both)]
|
||||
public async Task HandleWhois()
|
||||
{
|
||||
var user = RepliedUser ?? From;
|
||||
var message = $"{user.ToHtml(false)}\n";
|
||||
if (user.IsBot)
|
||||
{
|
||||
message += "<code>Бот</code>";
|
||||
}
|
||||
else
|
||||
{
|
||||
message += $"<code>Предупреждения: {(await GetWarnOption(user)).GetValue<int>()}</code>";
|
||||
}
|
||||
|
||||
await Reply(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user