Bot no longer awards itself currency in flower events. closes #1266

This commit is contained in:
Master Kwoth 2017-06-27 01:01:17 +02:00
parent 85a07d1cdd
commit aa5b7f96c7

View File

@ -153,6 +153,7 @@ namespace NadekoBot.Modules.Gambling
private readonly Logger _log; private readonly Logger _log;
private readonly DiscordSocketClient _client; private readonly DiscordSocketClient _client;
private readonly CurrencyService _cs; private readonly CurrencyService _cs;
private readonly SocketSelfUser _botUser;
private IUserMessage StartingMessage { get; set; } private IUserMessage StartingMessage { get; set; }
@ -164,6 +165,7 @@ namespace NadekoBot.Modules.Gambling
_log = LogManager.GetCurrentClassLogger(); _log = LogManager.GetCurrentClassLogger();
_client = client; _client = client;
_cs = cs; _cs = cs;
_botUser = client.CurrentUser;
Source = new CancellationTokenSource(); Source = new CancellationTokenSource();
CancelToken = Source.Token; CancelToken = Source.Token;
} }
@ -208,6 +210,9 @@ namespace NadekoBot.Modules.Gambling
{ {
try try
{ {
if (r.UserId == _botUser.Id)
return;
if (r.Emote.Name == "🌸" && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _flowerReactionAwardedUsers.Add(r.User.Value.Id)) if (r.Emote.Name == "🌸" && r.User.IsSpecified && ((DateTime.UtcNow - r.User.Value.CreatedAt).TotalDays > 5) && _flowerReactionAwardedUsers.Add(r.User.Value.Id))
{ {
await _cs.AddAsync(r.User.Value, "Flower Reaction Event", amount, false) await _cs.AddAsync(r.User.Value, "Flower Reaction Event", amount, false)