private async Task SetNick(SocketGuildUser user, [Remainder] string newName) { string currentName = user.Nickname; if (string.IsNullOrEmpty(user.Nickname)) { currentName = user.Username; } try { await user.ModifyAsync(x => x.Nickname = newName); await Context.Message.DeleteAsync(); var embedReplaceRemovedRole = new EmbedBuilder(); embedReplaceRemovedRole.WithTitle($"✅ {currentName} had their name changed successfully"); embedReplaceRemovedRole.WithColor(new Color(0, 255, 0)); await Context.Channel.SendMessageAsync("", false, embedReplaceRemovedRole.Build()); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task CleanChatUserAmount(SocketGuildUser user, int amountToDelete) { try { var usersocket = user as SocketGuildUser; int amount = 900; var msgsCollection = await Context.Channel.GetMessagesAsync(amount).FlattenAsync(); var result = from m in msgsCollection where m.Author == user select m.Id; var chnl = Context.Channel as ITextChannel; var totalToDelete = result.Take(amountToDelete); await chnl.DeleteMessagesAsync(totalToDelete); var cleanseUserEmbed = new EmbedBuilder(); cleanseUserEmbed.WithTitle($"✅ cleansed {totalToDelete.Count()} messages from {user.Username}"); cleanseUserEmbed.WithColor(new Color(0, 255, 0)); await Context.Channel.SendMessageAsync("", false, cleanseUserEmbed.Build()); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task MyMemeStore() { using (var db = new Memestorage()) { try { var memestoreArray = db.Memestore.AsQueryable().Where(x => x.AuthorID == Context.Message.Author.Id).ToArray(); var listOfMemes = new List <string>(); foreach (var item in memestoreArray) { listOfMemes.Add(item.Title); } var outputList = String.Join(", ", listOfMemes.ToArray()); var outputMessage = $"{Context.Message.Author.Username} is the owner of the memes: {outputList}"; if (outputMessage.Length >= 1999) { await Context.Channel.SendMessageAsync("well u made too many memes so im not gonna tell u, sry "); return; } await Context.Channel.SendMessageAsync(outputMessage); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } } }
private async Task LastOasisAllyRecruit(SocketGuildUser targetUser) { try { var loLeaderRole = Helpers.ReturnRole(Context.Guild, "Last Oasis Leader"); var author = Context.Message.Author as SocketGuildUser; if (author.Roles.Where(x => x.Id == loLeaderRole.Id).Any()) { var loAllyRole = Helpers.ReturnRole(Context.Guild, "Last Oasis Ally"); if (targetUser.Roles.Where(x => x.Id == loAllyRole.Id).Any()) { await Context.Channel.SendMessageAsync("User already is already an ally"); } else { await targetUser.AddRoleAsync(loAllyRole); await Context.Channel.SendMessageAsync($"{Context.Message.Author.Mention} recruited {targetUser.Mention} to the Last Oasis allies"); } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task MemeStoreMostPopular() { using (var db = new Memestorage()) { try { var collectionTopMemes = db.Memestore.AsQueryable().OrderByDescending(x => x.MemeUses).Take(10); List <string> topMemeAuthors = new List <string>(); topMemeAuthors.AddRange(collectionTopMemes.Select(x => x.Author)); List <string> topMemetitles = new List <string>(); topMemetitles.AddRange(collectionTopMemes.Select(x => x.MemeId + "#" + x.Title.Substring(0, 15))); List <ulong> topMemeUses = new List <ulong>(); topMemeUses.AddRange(collectionTopMemes.Select(x => x.MemeUses)); var embed = new EmbedBuilder(); embed.WithTitle($"Top memes in Melee Slasher"); embed.AddField("Number and Name: ", string.Join("\n", topMemetitles), true); embed.AddField("Author: ", string.Join("\n", topMemeAuthors), true); embed.AddField("Uses: ", string.Join("\n", topMemeUses), true); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } } }
private async Task LastOasisRemoveUser(SocketGuildUser targetUser) { try { var loLeaderRole = Helpers.ReturnRole(Context.Guild, "Last Oasis Leader"); var author = Context.Message.Author as SocketGuildUser; if (author.Roles.Where(x => x.Id == loLeaderRole.Id).Any()) { var loRole = Helpers.ReturnRole(Context.Guild, "🌴 Last Oasis"); if (!targetUser.Roles.Where(x => x.Id == loRole.Id).Any()) { await Context.Channel.SendMessageAsync("User isn't part of the crew anyway m8"); } else { await targetUser.RemoveRoleAsync(loRole); await Context.Channel.SendMessageAsync($"{Context.Message.Author.Mention} removed {targetUser.Mention} from the Last Oasis team"); } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task LastOasisEmergency([Remainder] string inputMessage) { try { if (Context.Message.Author.Id == 185464319641649153 || Context.Message.Author.Id == 347462177017430017) { return; } if (Context.Message.Channel.Id == 693097204675510333) { IRole LastOasisRole = Helpers.ReturnRole(Context.Guild, "🌴 Last Oasis"); await LastOasisRole.ModifyAsync(x => x.Mentionable = true); var embed = new EmbedBuilder(); embed.WithTitle("EMERGENCY IN LAST OASIS"); embed.WithDescription($"Called by {Context.Message.Author}\n{inputMessage}"); embed.ThumbnailUrl = "https://cdn.discordapp.com/attachments/693097204675510333/696842499729260575/zNID4uCK_400x400.png"; embed.WithColor(new Color(0, 204, 255)); await Context.Channel.SendMessageAsync(LastOasisRole.Mention, false, embed.Build()); await LastOasisRole.ModifyAsync(x => x.Mentionable = false); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task RandomCallMeme() { bool success = false; var insult = await Insults.GetInsult(); var rnd = new Random(); using (var db = new Memestorage()) { try { while (success == false) { var maxID = db.Memestore.Max(x => x.MemeId); var meme = db.Memestore.AsQueryable().Where(x => x.MemeId == rnd.Next(0, maxID)).FirstOrDefault(); if (meme != null && !string.IsNullOrEmpty(meme.Content)) { await Context.Channel.SendMessageAsync($"Meme#{meme.MemeId}: {meme.Content}"); success = true; } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } } }
private async Task CallMeme(string input) { try { using (var db = new Memestorage()) { var meme = db.Memestore.AsQueryable().Where(x => x.Title.ToLower() == input.ToLower()).FirstOrDefault(); if (meme != null) { if (!string.IsNullOrEmpty(meme.Content)) { Regex rgx = new Regex("(<@![0-9]+>)"); var match = rgx.Match(meme.Content); if (match.Success) { db.Memestore.Remove(meme); await Context.Channel.SendMessageAsync($"{meme.Title} contained some pings so get deleted son lmfao hahahah"); } else { meme.MemeUses = meme.MemeUses + 1; await Context.Channel.SendMessageAsync($"{meme.Content}"); } } await db.SaveChangesAsync(); } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task HackBanUser([Remainder] string input) { try { if (!input.Contains(' ')) { var insult = await Personality.Insults.GetInsult(); await Context.Channel.SendMessageAsync($"syntax is \"{Global.Config.CommandPrefix}hackban uintID reason\" you f*****g {insult}"); return; } string[] inputArray = input.Split(' '); if (!ulong.TryParse(inputArray[0], out ulong targetID)) { var insult = await Personality.Insults.GetInsult(); await Context.Channel.SendMessageAsync($"Unable to parse that ID {insult} c**t"); return; } string reason = string.Join(' ', inputArray.Skip(1)); await Context.Guild.AddBanAsync(targetID, 0, reason); await Context.Channel.SendMessageAsync($"Banned userID {targetID}, reason: {reason}"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task LastOasisEmergency() { try { await Context.Channel.SendMessageAsync("Write a reason!"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task SetNick(SocketGuildUser user) { try { await user.ModifyAsync(x => x.Nickname = user.Username); await Context.Channel.SendMessageAsync("name reset 👍"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task InviteLinkCheck(SocketCommandContext context) { try { if (regexInviteLinkDiscord.Match(context.Message.Content).Success & !Helpers.IsModeratorOrOwner(context.Message.Author as SocketGuildUser)) { await _inviteLinkPreventation.DeleteInviteLinkWarn(context); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task StoreRoles(SocketGuildUser target) { try { var storeRoles = new StoreRoleMethods(); await storeRoles.StoreUserRoles(Context, target); await Context.Channel.SendMessageAsync($"{target.Username} successfully had their roles stored"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task MassMentionCheck(SocketCommandContext context) { try { if (await _massMentionControl.CheckForMentionSpam(context)) { await _massMentionControl.MassMentionMute(context, context.Message); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task TurnedOffMessagesCheck(SocketCommandContext context) { try { if (Helpers.OnOffExecution(context.Message) == true) { await context.Message.DeleteAsync(); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task VCMove(SocketGuildUser user, IVoiceChannel chnl) { try { if (Context.Message.Author.Id == 161176590028505089) { return; // no bob } var insult = await Insults.GetInsult(); if (user.Id == Context.Message.Author.Id || Helpers.IsVKOrModeratorOrOwner(user)) { await Context.Channel.SendMessageAsync($"yeah nice try retard {insult}"); return; } if (user.VoiceChannel != null) { var oldChannel = user.VoiceChannel as IVoiceChannel; if (chnl.Id == oldChannel.Id) { await Context.Channel.SendMessageAsync($"why would i move him to the same channel you f*****g {insult}"); return; } var channel = Optional.Create <IVoiceChannel>(chnl); await user.ModifyAsync(x => { x.Channel = channel; }); await Context.Channel.SendMessageAsync($"{user.Mention} moved from {oldChannel} to voice channel {chnl}"); return; } ; await Context.Channel.SendMessageAsync($"{user.Mention} needs to connect to a voice channel to be moved"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
public async Task DeleteInviteLinkWarn(SocketCommandContext context) { try { var insult = await Insults.GetInsult(); await context.Message.DeleteAsync(); await context.Channel.SendMessageAsync($"{context.User.Mention}, don't post invite links {insult}"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task MemeStoreCount() { using (var db = new Memestorage()) { try { var memestoreCount = db.Memestore.AsQueryable().Where(x => x.Content != null).Count(); await Context.Channel.SendMessageAsync($"there are currently {memestoreCount} active memes in the database."); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } } }
internal static async Task PunishNaughtyWord(SocketCommandContext context) { try { await context.Message.DeleteAsync(); } catch (HttpException ex) { //do nothing } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly("WorldFilter", ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task EditMeme([Remainder] string input) { try { var inputAsArray = input.Split(" "); var title = inputAsArray[0].ToString(); var contentOfMessage = String.Join(" ", inputAsArray.Skip(1)); var insult = await Insults.GetInsult(); if (contentOfMessage.Length < 2) { await Context.Channel.SendMessageAsync($"wat r u tryin to do"); 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; } using (var db = new Memestorage()) { if (db.Memestore.AsQueryable().Where(x => x.Title.ToLower() == title.ToLower()).Any()) { var meme = db.Memestore.AsQueryable().Where(x => x.Title.ToLower() == title.ToLower()).FirstOrDefault(); //is it a valid user ? (mod/original author) if (Helpers.IsModeratorOrOwner(Context.Message.Author as SocketGuildUser) || meme.AuthorID == Context.Message.Author.Id) { meme.Content = contentOfMessage; await db.SaveChangesAsync(); await Context.Channel.SendMessageAsync($"{title} was successfully updated"); return; } } await Context.Channel.SendMessageAsync($"nah ur not allowed nice try tho lmfao {insult}"); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task CleanChatAmount(int amount) { try { var messages = await Context.Channel.GetMessagesAsync(amount + 1).FlattenAsync(); var chnl = Context.Channel as ITextChannel; await chnl.DeleteMessagesAsync(messages); await Context.Channel.SendMessageAsync("wat ? 😃"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
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 AdditionalChatSmileyCheck(SocketCommandContext context) { try { if (context.Message.Content.Contains("😃")) { var r = new Random(); if (r.Next(1, 15) <= 2) { await context.Channel.SendMessageAsync("😃"); } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task KuffsoneWeirdoCheck(SocketCommandContext context) { try { if (context.Message.Author.Id == 215903917630947328) { var rnd = new Random(); if (rnd.Next(1, 25) <= 2) { await context.Channel.SendMessageAsync($"kuffsone is a weirdo stalker btw ({context.Message.Author.Mention})"); } } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task MemeCreatedDetails(int id) { using (var db = new Memestorage()) { try { var meme = db.Memestore.AsQueryable().Where(x => x.MemeId == id).FirstOrDefault(); if (meme != null) { await Context.Channel.SendMessageAsync($"{meme.Title} was created by {meme.Author} on {meme.Date} at {meme.Time}. MemeID = {meme.MemeId}"); } } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } } }
private async Task DeleteMeme([Remainder] string input) { try { var inputAsArray = input.Split(" "); var title = inputAsArray[0].ToString(); var insult = await Insults.GetInsult(); if (inputAsArray.Count() > 1) { await Context.Channel.SendMessageAsync("wtf is that supposed to be?"); return; } using (var db = new Memestorage()) { if (!db.Memestore.AsQueryable().Where(x => x.Title.ToLower() == title.ToLower()).Any()) { await Context.Channel.SendMessageAsync($"there's no {title} {insult}"); return; } var rowToRemove = db.Memestore.AsQueryable().Where(x => x.Title.ToLower() == title.ToLower()).SingleOrDefault(); //needs to be original author or moderator if (Helpers.IsModeratorOrOwner(Context.Message.Author as SocketGuildUser) || rowToRemove.AuthorID == Context.Message.Author.Id) { db.Memestore.Remove(rowToRemove); await db.SaveChangesAsync(); await Context.Channel.SendMessageAsync($"{title} was deleted successfully from the DB"); return; } await Context.Channel.SendMessageAsync($"only the original author or moderator can delete this"); } } 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); } }
public async Task MassMentionMute(SocketCommandContext context, SocketUserMessage message) { try { IGuildUser targetUser = context.Guild.GetUser(message.Author.Id) as IGuildUser; IRole moderators = Helpers.ReturnRole(context.Guild, UtilityRoles.Moderator); var mutedRole = Helpers.ReturnRole(context.Guild, "SuperMuted"); ITextChannel adminlogchannel = context.Guild.GetChannel(Global.Config.AuditChannel) as ITextChannel; await targetUser.AddRoleAsync(mutedRole); await context.Channel.SendMessageAsync($"stay small {message.Author.Mention}, no spam in my server you little shitter"); await adminlogchannel.SendMessageAsync($"{targetUser.Username}#{targetUser.DiscriminatorValue} has been auto muted for mass mention, please investigate {moderators.Mention}"); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }
private async Task KickUser(SocketGuildUser user, [Remainder] string reason) { if (Helpers.IsRole(UtilityRoles.Moderator, (SocketGuildUser)user)) { await Context.Channel.SendMessageAsync("stop fighting urselves u retards"); return; } if (reason.Length < 1) { reason = "cya"; } string kickTargetName = user.Username; try { await user.KickAsync(reason); var embed = new EmbedBuilder(); embed.WithTitle($"✅ {Context.User.Username} _booted_ {kickTargetName}"); embed.WithDescription($"reason: **{reason}**"); embed.WithColor(new Color(0, 255, 0)); await Context.Channel.SendMessageAsync("", false, embed.Build()); } catch (Exception ex) { await ExceptionHandler.HandleExceptionPublically(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } try { var storeRoles = new StoreRoleMethods(); await storeRoles.StoreUserRoles(Context, user as SocketGuildUser); } catch (Exception ex) { await ExceptionHandler.HandleExceptionQuietly(GetType().FullName, ExceptionHandler.GetAsyncMethodName(), ex); } }