public async Task Neps() { int counter = 0; foreach (var item in Program.Guilds) { counter = counter + item.Value.Nep; } try { var emote = GuildEmote.Parse(Program.nepmote).Url; await ReplyAsync("", false, Embed.GetEmbed("Neps!", $"The current ammount of neps in this server is {counter}, the current amount of neps overall is {Program.Guilds.GetValueOrDefault(Context.Guild.Id).Nep}", await Program.GetUserColour(Context.Message.Author.Id), "Nep Nep", emote)); } catch { await ReplyAsync("", false, Embed.GetEmbed("Neps!", $"There was an error calculating neps")); } }
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; }