From 257dbcb73824c312a5f970ee5ca76b54bc9bdd6b Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sun, 15 Jan 2017 18:04:22 +0100 Subject: [PATCH] Fixed flower event hopefully. --- .../Gambling/Commands/CurrencyEvents.cs | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/src/NadekoBot/Modules/Gambling/Commands/CurrencyEvents.cs b/src/NadekoBot/Modules/Gambling/Commands/CurrencyEvents.cs index 9b43f842..d7d2d783 100644 --- a/src/NadekoBot/Modules/Gambling/Commands/CurrencyEvents.cs +++ b/src/NadekoBot/Modules/Gambling/Commands/CurrencyEvents.cs @@ -30,15 +30,19 @@ namespace NadekoBot.Modules.Gambling public async Task StartEvent(CurrencyEvent e) { var channel = (ITextChannel)Context.Channel; - - switch (e) + try { - case CurrencyEvent.FlowerReaction: - await FlowerReactionEvent(Context).ConfigureAwait(false); - break; - default: - break; + + switch (e) + { + case CurrencyEvent.FlowerReaction: + await FlowerReactionEvent(Context).ConfigureAwait(false); + break; + default: + break; + } } + catch { } } @@ -48,13 +52,26 @@ namespace NadekoBot.Modules.Gambling "Add 🌸 reaction to this message to get 100" + NadekoBot.BotConfig.CurrencySign, footer: "This event is active for 24 hours.") .ConfigureAwait(false); - await msg.AddReactionAsync("🌸").ConfigureAwait(false); + try { await msg.AddReactionAsync("🌸").ConfigureAwait(false); } + catch + { + try { await msg.AddReactionAsync("🌸").ConfigureAwait(false); } + catch + { + try { await msg.DeleteAsync().ConfigureAwait(false); } + catch { } + } + } using (msg.OnReaction(async (r) => { - if (r.Emoji.Name == "🌸" && r.User.IsSpecified && _flowerReactionAwardedUsers.Add(r.User.Value.Id)) + try { - try { await CurrencyHandler.AddCurrencyAsync(r.User.Value, "Flower Reaction Event", 100, true).ConfigureAwait(false); } catch { } + if (r.Emoji.Name == "🌸" && r.User.IsSpecified && _flowerReactionAwardedUsers.Add(r.User.Value.Id)) + { + try { await CurrencyHandler.AddCurrencyAsync(r.User.Value, "Flower Reaction Event", 100, true).ConfigureAwait(false); } catch { } + } } + catch { } })) { await Task.Delay(TimeSpan.FromHours(24)).ConfigureAwait(false);