private async Task Client_ReactionAdded(Cacheable <IUserMessage, ulong> arg1, ISocketMessageChannel arg2, SocketReaction arg3) { var Iusermsg = arg1.Value as IUserMessage; if (Iusermsg.Author.IsBot) { return; } var users = Iusermsg.Reactions; try { foreach (var item in users.Where(x => x.Key.Name == arg3.Emote.Name)) { if (!item.Value.IsMe && arg3.UserId == OwnerID) { await Iusermsg.AddReactionAsync(arg3.Emote); } } } catch (Exception e) { await Log.WriteToLog(e); } XP.AddXPAsync(Iusermsg); await Task.CompletedTask; }
private async Task Client_MessageReceived(SocketMessage arg) { var Iusermsg = arg as IUserMessage; //is self? if (Iusermsg.Author.Id == Client.CurrentUser.Id) { return; } //is dm? bool dm = false; if (await DirectMessages.IsDMAsync(arg, Client)) { DirectMessages.ForwardDMs(arg, Client); dm = true; } //Get user and guild objects User user = Users.GetValueOrDefault(Iusermsg.Author.Id); Guild guild = null; SocketTextChannel tmp; if (!dm) { tmp = Iusermsg.Channel as SocketTextChannel; guild = Guilds.GetValueOrDefault(tmp.Guild.Id); } //blacklisted? if (user.Blacklisted) { return; } if (guild.Blacklisted) { return; } if (!dm) { if (jail.Contains(arg.Author as IGuildUser)) { var jailedmessage = arg as IUserMessage; await jailedmessage.AddReactionAsync(new Emoji("🛂")); return; } if (guild.Activity) { activity.SendTypingAsync(arg); activity.Emoji(arg as IUserMessage, 30); } if (Iusermsg.Content.ToLower().Contains("nep") && Iusermsg.Content.ToLower() != $"{guild.Prefix}neps") { guild.Nep++; try { await Iusermsg.AddReactionAsync(GuildEmote.Parse(nepmote)); } catch { await Log.WriteToLog("Could not parse nepmote"); } await EditGuild(guild); } //Profile Stuff Currency.AddCurrencyAsync(user.Id); XP.AddXPAsync(Iusermsg); //Commands await HandleCommandAsync(arg); } await Task.CompletedTask; }