private async void OnDiscordReactionAdded(BotChannel bChan, UserEntry user, DiscordReactionArgument args) { // Ignore self reaction string botName = Cipher.Decrypt(Program.BotName); if (user._discordUsername != botName) { RolesSettings settings = await Settings <RolesSettings>(bChan, PLUGINNAME); if (!settings._active) { return; } if (!settings.RoleTable.ContainsValue(args.Emote)) { return; } string role = settings.RoleTable.FirstOrDefault(x => x.Value == args.Emote).Key; //BotWideResponseArguments response = new BotWideResponseArguments(args); if (settings.MarkedMessages.Exists(p => p.MessageID == args.MessageID)) { if (await MisfitBot_MKII.DiscordWrap.DiscordClient.RoleAddUser(bChan, user, role) == false) { await Core.LOG(new LogEntry(LOGSEVERITY.INFO, "RolesPlugin", $"OnDiscordReactionAdded Failed to add user({user._discordUsername}) to role({role})")); } } } }
internal async void RaiseDiscordReactionAdded(BotChannel bChan, UserEntry user, DiscordReactionArgument args) { await Task.Run(() => { if (bChan != null && user != null) { OnDiscordReactionAdded?.Invoke(bChan, user, args); } }); }