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