mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
Add a bit of logging to AwardCommand and ChangeLocaleCommand
This commit is contained in:
parent
1159af1785
commit
6a4ee6e791
@ -6,12 +6,14 @@ using Telegram.Bot.Args;
|
||||
using Telegram.Bot.Types;
|
||||
using Perfusion;
|
||||
using JetKarmaBot.Services;
|
||||
using NLog;
|
||||
|
||||
namespace JetKarmaBot.Commands
|
||||
{
|
||||
class AwardCommand : IChatCommand
|
||||
{
|
||||
public IReadOnlyCollection<string> Names => new[] { "award", "revoke" };
|
||||
private static Logger log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public bool Execute(CommandString cmd, MessageEventArgs args)
|
||||
{
|
||||
@ -63,7 +65,7 @@ namespace JetKarmaBot.Commands
|
||||
ToId = recipient.Id,
|
||||
ChatId = args.Message.Chat.Id
|
||||
});
|
||||
|
||||
log.Debug($"Awarded {(awarding ? 1 : -1)}{awardType.Symbol} to {recipient.Username}");
|
||||
db.SaveChanges();
|
||||
|
||||
string message = awarding
|
||||
|
||||
@ -3,12 +3,14 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Args;
|
||||
using Perfusion;
|
||||
using JetKarmaBot.Services;
|
||||
using NLog;
|
||||
|
||||
namespace JetKarmaBot.Commands
|
||||
{
|
||||
class LocaleCommand : IChatCommand
|
||||
{
|
||||
public IReadOnlyCollection<string> Names => new[] { "changelocale", "locale" };
|
||||
private static Logger log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public bool Execute(CommandString cmd, MessageEventArgs args)
|
||||
{
|
||||
@ -29,6 +31,7 @@ namespace JetKarmaBot.Commands
|
||||
else
|
||||
localeId = Locale.FindByCommonName(cmd.Parameters[0]).Name;
|
||||
db.Chats.Find(args.Message.Chat.Id).Locale = localeId;
|
||||
log.Debug($"Changed language of chat {args.Message.Chat.Id} to {localeId}");
|
||||
db.SaveChanges();
|
||||
|
||||
currentLocale = Locale[db.Chats.Find(args.Message.Chat.Id).Locale];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user