public async Task HandleInteraction(DiscordClient discord, ComponentInteractionCreateEventArgs e) { Logger.Log(Logging.EventsHandled); if (Settings.Test && e.Message.Channel.GuildId != Settings.TestGuild) { return; } Response response = null; if (CachedMisses.Contains(e.Message.Id)) { response = CachedMisses[e.Message.Id]; } if (e.Message.Interaction != null && CachedMisses.Contains(e.Message.Interaction.Id)) { response = CachedMisses[e.Message.Interaction.Id]; } if (response != null && !e.User.IsCurrent && !e.User.IsBot) { int index = int.Parse(e.Id) - 1; Logger.Log(Logging.ReactionCalls); _ = Task.Run(() => UpdateResponse(e, response, index)); await Task.CompletedTask; } }
public async Task HandleReaction(DiscordClient discord, MessageReactionAddEventArgs e) { Logger.Log(Logging.EventsHandled); if (Settings.Test && e.Message.Channel.GuildId != Settings.TestChannel) { return; } var guildSettings = Settings.GetGuild(e.Channel); if (CachedMisses.Contains(e.Message) && !e.User.IsCurrent && !e.User.IsBot) { var savedMiss = CachedMisses[e.Message]; var analyzer = savedMiss.MissAnalyzer; // switch (e.Emoji.GetDiscordName()) // { // case ":heavy_plus_sign:": // break; // case ":heavy_minus_sign:": // break; // case ":" // } int index = Array.FindIndex(numberEmojis, t => t == e.Emoji) - 1; if (index >= 0 && index < Math.Min(analyzer.MissCount, numberEmojis.Length - 1)) { Task.Run(() => ProcessReaction(e, guildSettings, savedMiss, index)); } } }
public async Task HandleReaction(DiscordClient discord, MessageReactionAddEventArgs e) { Logger.Log(Logging.EventsHandled); if (Settings.Test && e.Message.Channel.GuildId != Settings.TestGuild) { return; } if (CachedMisses.Contains(e.Message.Id) && !e.User.IsCurrent && !e.User.IsBot) { var response = CachedMisses[e.Message.Id]; var analyzer = response.Miss.MissAnalyzer; int index = Array.FindIndex(numberEmojis, t => t == e.Emoji) - 1; if (index >= 0 && index < Math.Min(analyzer.MissCount, numberEmojis.Length - 1)) { Logger.Log(Logging.ReactionCalls); _ = Task.Run(() => UpdateResponse(e, response, index)); await Task.CompletedTask; } } }