Fixed flower event hopefully.

This commit is contained in:
Kwoth 2017-01-15 18:04:22 +01:00
parent d8d657e6bd
commit 257dbcb738

View File

@ -30,6 +30,8 @@ namespace NadekoBot.Modules.Gambling
public async Task StartEvent(CurrencyEvent e) public async Task StartEvent(CurrencyEvent e)
{ {
var channel = (ITextChannel)Context.Channel; var channel = (ITextChannel)Context.Channel;
try
{
switch (e) switch (e)
{ {
@ -40,6 +42,8 @@ namespace NadekoBot.Modules.Gambling
break; break;
} }
} }
catch { }
}
public static async Task FlowerReactionEvent(CommandContext Context) public static async Task FlowerReactionEvent(CommandContext Context)
@ -48,13 +52,26 @@ namespace NadekoBot.Modules.Gambling
"Add 🌸 reaction to this message to get 100" + NadekoBot.BotConfig.CurrencySign, "Add 🌸 reaction to this message to get 100" + NadekoBot.BotConfig.CurrencySign,
footer: "This event is active for 24 hours.") footer: "This event is active for 24 hours.")
.ConfigureAwait(false); .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) => using (msg.OnReaction(async (r) =>
{
try
{ {
if (r.Emoji.Name == "🌸" && r.User.IsSpecified && _flowerReactionAwardedUsers.Add(r.User.Value.Id)) 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 { } try { await CurrencyHandler.AddCurrencyAsync(r.User.Value, "Flower Reaction Event", 100, true).ConfigureAwait(false); } catch { }
} }
}
catch { }
})) }))
{ {
await Task.Delay(TimeSpan.FromHours(24)).ConfigureAwait(false); await Task.Delay(TimeSpan.FromHours(24)).ConfigureAwait(false);