private async Task NaughtyWordFilter(SocketCommandContext context) { try { if (context.Message.Content != null) { if (await WordFilter.CheckForNaughtyWords(context.Message.Content)) { await WordFilter.PunishNaughtyWord(context); } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task NountestCheck(SocketCommandContext context) { try { if (!string.IsNullOrWhiteSpace(context.Message.Content)) { if (!await WordFilter.CheckForNaughtyWords(context.Message.Content)) { if (Nountest.CheckForNountest(context.Message.Content.Split(" ")[0])) { await _nounTest.PostNounTest(context); } } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task StoreMeme([Remainder] string input) { try { var inputAsArray = input.Split(" "); var title = inputAsArray[0].ToString(); title = Regex.Replace(title, @"\t|\n|\r", ""); var contentOfMessage = String.Join(" ", inputAsArray.Skip(1)); var insult = await Insults.GetInsult(); if (contentOfMessage.Length < 2) { await Context.Channel.SendMessageAsync($"what the f**k are you actually doing you f*****g {insult}, why are you trying to make an empty meme ? r u legit f*****g autist or what, fuckign dumb {insult} c**t"); return; } if (title.Where(x => Char.IsDigit(x)).Any()) { await Context.Channel.SendMessageAsync($"the meme title can't contain numbers or weird shit, sry bitch"); return; } if (await WordFilter.CheckForNaughtyWords(contentOfMessage) || await WordFilter.CheckForNaughtyWords(title)) { await Context.Channel.SendMessageAsync($"dont put nasty language in the memestore {insult}"); return; } using (var db = new Memestorage()) { if (db.Memestore.AsQueryable().Where(x => x.AuthorID == Context.Message.Author.Id).Count() >= 25) { await Context.Channel.SendMessageAsync($"f*****g greedy f**k {insult} bastard u cannot make over 25 memes"); return; } if (db.Memestore.AsQueryable().Where(x => x.Title.ToLower() == title.ToLower()).Any()) { await Context.Channel.SendMessageAsync($"that alrdy exists u {insult}"); return; } await db.Memestore.AddAsync(new MemeStoreModel { Author = Context.Message.Author.Username, AuthorID = Context.Message.Author.Id, Content = contentOfMessage, Title = title, Date = DateTime.Now.ToShortDateString(), Time = DateTime.Now.ToShortTimeString() }); await db.SaveChangesAsync(); await Context.Channel.SendMessageAsync($"{title} was successfully created!"); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }