public Chess() : base("chess", "Play chess", false) { HelpMenu = new EmbedBuilder(); HelpMenu.WithColor(0, 128, 255); HelpMenu.AddFieldDirectly(Prefix + CommandLine + " newGame + a mentioned user", "Creates a new game against the mentioned user"); HelpMenu.AddFieldDirectly(Prefix + CommandLine + " move + 2 coordinates", "Moves a chess piece from the first point to the second\n" + "eg. " + Prefix + CommandLine + " move 1,1 3,1"); HelpMenu.AddFieldDirectly(Prefix + CommandLine + " game", "Prints the game you are currently in"); HelpMenu.WithDescription("Chess Commands:"); }
public override void Execute(IMessage message) { string[] split = message.Content.Split(new char[] { ' ', '\n' }); if (split.Length == 1) { EmbedBuilder Embed = new EmbedBuilder(); Embed.WithColor(0, 128, 255); foreach (PlaceCommand Pcommand in subCommands) { Embed.AddFieldDirectly(Prefix + CommandLine + " " + Pcommand.command, Pcommand.desc); } Embed.WithDescription("Place Commands:"); DiscordNETWrapper.SendEmbed(Embed, message.Channel).Wait(); DiscordNETWrapper.SendFile(filePath, message.Channel).Wait(); } else { foreach (PlaceCommand Pcommand in subCommands) { if (split[1] == Pcommand.command && Pcommand.check(split, message.Channel)) { Pcommand.execute(message, filePath, split); break; } } } }
public override void Execute(IMessage message) { string[] split = message.Content.Split(new char[] { ' ', '\n' }); if (split.Length == 1) { EmbedBuilder Embed = new EmbedBuilder(); Embed.WithColor(0, 128, 255); foreach (Reaction react in reactions) { Embed.AddFieldDirectly(Prefix + CommandLine + " " + react.name, react.desc); } Embed.WithDescription("Reactions:"); DiscordNETWrapper.SendEmbed(Embed, message.Channel).Wait(); } else { string command = split.Skip(1).Aggregate((x, y) => x + " " + y).ToLower(); int[] scores = new int[reactions.Length]; for (int i = 0; i < reactions.Length; i++) { scores[i] = command.LevenshteinDistance(reactions[i].name.ToLower()); } int index = Array.IndexOf(scores, scores.Min()); reactions[index].execute(message); } }
public override void Execute(IMessage commandmessage) { EmbedBuilder Embed = new EmbedBuilder(); Embed.WithColor(0, 128, 255); if (Config.Data.UserList.Exists(x => x.UserID == commandmessage.Author.Id)) { DiscordUser User = Config.Data.UserList.Find(x => x.UserID == commandmessage.Author.Id); FieldInfo[] Infos = typeof(DiscordUser).GetFields(); foreach (FieldInfo info in Infos) { if (info.FieldType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(info.FieldType)) { IEnumerable a = (IEnumerable)info.GetValue(User); string value = ""; try { IEnumerator e = a.GetEnumerator(); e.Reset(); while (e.MoveNext()) { value += e.Current + "\n"; } } catch { } Embed.AddFieldDirectly(info.Name + ":", value == "" ? "null" : value); } else { Embed.AddFieldDirectly(info.Name + ":", info.GetValue(User)); } } Embed.WithDescription("Profile of " + commandmessage.Author.Mention); } else { Embed.AddFieldDirectly("Error!", "The bot hasn't made a profile of you yet."); } DiscordNETWrapper.SendEmbed(Embed, commandmessage.Channel).Wait(); }
public Uno() : base("uno", "Play uno with other humanoids", false) { HelpMenu = new EmbedBuilder(); HelpMenu.WithColor(0, 128, 255); HelpMenu.WithDescription("Uno Commands:"); HelpMenu.AddFieldDirectly(PrefixAndCommand + " new + mentioned users", "Creates a new game with the mentioned users"); HelpMenu.AddFieldDirectly(PrefixAndCommand + " move + cardType + cardColor", "Puts the card on the stack\n" + $"eg. {PrefixAndCommand} move 1 green\n" + $"eg. {PrefixAndCommand} move plus4 rEd\n" + $"The latter will move a Plus4 and change the stacks color to Red, Plus4/ChangeColor cards don't have a color though"); HelpMenu.AddFieldDirectly(PrefixAndCommand + " draw", "Draw a new card"); HelpMenu.AddFieldDirectly(PrefixAndCommand + " print", "Prints the stack of the game you are currently in"); HelpMenu.AddFieldDirectly(PrefixAndCommand + " cancel", "Cancels the game you are currently in"); HelpMenu.AddFieldDirectly("Valid Cards are: ", UnoCards.Select(x => x.Type + (x.Color == UnoColor.none ? "" : " " + x.Color.ToString())).Aggregate((x, y) => x + ", " + y)); }
public override void Execute(IMessage message) { if (message.Author.Id != Program.Master.Id) { DiscordNETWrapper.SendText("Sorry but only my Owner is allowed to use this Command.", message.Channel).Wait(); } else { EmbedBuilder Embed = new EmbedBuilder(); Embed.WithColor(0, 128, 255); Embed.AddFieldDirectly("CurrentDirectory", System.Environment.CurrentDirectory); Embed.AddFieldDirectly("Is64BitOperatingSystem", System.Environment.Is64BitOperatingSystem); Embed.AddFieldDirectly("MachineName", System.Environment.MachineName); Embed.AddFieldDirectly("OSVersion", System.Environment.OSVersion); Embed.AddFieldDirectly("ProcessorCount", System.Environment.ProcessorCount); Embed.AddFieldDirectly("SystemPageSize", System.Environment.SystemPageSize); Embed.AddFieldDirectly("System Start Time", DateTime.Now.Subtract(new TimeSpan(0, 0, 0, 0, System.Environment.TickCount))); Embed.AddFieldDirectly("UserDomainName", System.Environment.UserDomainName); Embed.AddFieldDirectly("UserInteractive", System.Environment.UserInteractive); Embed.AddFieldDirectly("UserName", System.Environment.UserName); Embed.AddFieldDirectly("Version", System.Environment.Version); Embed.AddFieldDirectly("WorkingSet", System.Environment.WorkingSet); DiscordNETWrapper.SendEmbed(Embed, message.Channel).Wait(); } }
public override void Execute(IMessage message) { SocketGuild g = Program.GetGuildFromChannel(message.Channel); EmbedBuilder info = new EmbedBuilder(); info.WithDescription("Server-Information"); info.AddFieldDirectly("Channels", g.Channels.Count, true); info.AddFieldDirectly("Category Channels", g.CategoryChannels.Count, true); info.AddFieldDirectly("Text Channels", g.TextChannels.Count, true); info.AddFieldDirectly("Voice Channels", g.VoiceChannels.Count, true); info.AddFieldDirectly("Owner", g.Owner.GetDisplayName(), true); info.AddFieldDirectly("Created At", g.CreatedAt, true); info.AddFieldDirectly("Member Count", g.MemberCount, true); info.AddFieldDirectly("Human Count", g.Users.Where(x => !x.IsBot).Count(), true); info.AddFieldDirectly("Bot Count", g.Users.Where(x => x.IsBot).Count(), true); info.AddFieldDirectly("Emotes", g.Emotes.Count, true); info.AddFieldDirectly("Features", g.Features.Value, true); info.AddFieldDirectly("Mfa Level", g.MfaLevel, true); info.AddFieldDirectly("Icon Url", g.IconUrl, true); if (g.SplashUrl != null) { info.AddFieldDirectly("Splash Url", g.SplashUrl, true); } info.AddFieldDirectly("Roles:", g.Roles.OrderByDescending(x => x.Position). Select(x => $"[{x.Members.Count()}]{x.Name.Replace("*", "\\*")}").Aggregate((x, y) => x + "\n" + y), true); info.AddFieldDirectly("Verification Level", g.VerificationLevel, true); info.AddFieldDirectly("Voice Region Id", g.VoiceRegionId, true); info.AddFieldDirectly("User with the most roles:", $"{g.Users.MaxElement(x => x.Roles.Count, out double max)} with {max} Roles" + (g.Users.Where(x => x.Roles.Count == max).Count() > 1 ? $"\nbut they share thier first place with: {g.Users.Where(x => x.Roles.Count == max).Skip(1).Select(x => x.GetDisplayName()).Combine(", ")}" : ""), true); info.AddFieldDirectly("User with the longest name:", $"{g.Users.MaxElement(x => x.GetDisplayName().Length, out max)}" + (g.Users.Where(x => x.GetDisplayName().Length == max).Count() > 1 ? $"\nbut they share thier first place with: {g.Users.Where(x => x.GetDisplayName().Length == max).Skip(1).Select(x => x.ToString()).Combine(", ")}" : ""), true); try { // TODO: Many activities many confoos info.AddFieldDirectly("Played Games: ", (from user in g.Users where user.Activities.Count > 0 && user.Activities.First().Type == ActivityType.Playing group user by user.Activities.First().Name into x select $"[{x.Count()}]{x.Key}"). Aggregate((x, y) => x + "\n" + y), true); } catch { } DiscordNETWrapper.SendEmbed(info, message.Channel).Wait(); return; }
public override void Execute(IMessage message) { string[] split = message.Content.Split(new char[] { ' ', '\n' }); DiscordUser user = Config.Data.UserList.Find(x => x.UserID == message.Author.Id); user.WarframeChannelID = message.Channel.Id; if (split.Length == 1) { DiscordNETWrapper.SendEmbed(HelpMenu, message.Channel).Wait(); } else if (split[1] == "filters") { EmbedBuilder embed = new EmbedBuilder(); embed.AddFieldDirectly("Your Filters: ", (user.WarframeFilters.Count == 0 ? "Well that looks pretty empty" : user.WarframeFilters.Aggregate((x, y) => x + "\n" + y))); DiscordNETWrapper.SendEmbed(embed, message.Channel).Wait(); } else if (split[1] == "state") { List <EmbedBuilder> es = GetStateEmbeds(); if (es == null) { DiscordNETWrapper.SendText($"Couldn't get information. {WarframeHandler.WebSite} is probably down.", message.Channel).Wait(); return; } if (split.Length > 2) { EmbedBuilder e = es.FirstOrDefault(x => x.Title.ToLower().Contains(split[2].ToLower())); if (e == null) { DiscordNETWrapper.SendText($"Could not find \"{split[2]}\"", message.Channel).Wait(); } else { DiscordNETWrapper.SendEmbed(e, message.Channel).Wait(); } } else { foreach (EmbedBuilder e in es) { DiscordNETWrapper.SendEmbed(e, message.Channel).Wait(); } } } else { EmbedBuilder embed = new EmbedBuilder(); lock (lockject) { bool executedSomething = false; string[] filterComs = split.Skip(1).Aggregate((x, y) => x + " " + y).Split(','); foreach (string filterCom in filterComs) { string filterComTrim = filterCom.Trim(' '); if (filterComTrim.StartsWith("+")) { string filter = filterComTrim.Remove(0, 1).Trim(' '); if (user.WarframeFilters.Contains(filter)) { embed.AddFieldDirectly("You already have that filter fam", filter); } else { user.WarframeFilters.Add(filter); embed.AddFieldDirectly("Added filter: ", filter); } executedSomething = true; } else if (filterComTrim.StartsWith("-")) { string filter = filterComTrim.Remove(0, 1).Trim(' '); if (user.WarframeFilters.Contains(filter)) { user.WarframeFilters.Remove(filter); embed.AddFieldDirectly("Removed filter: ", filter); } else { embed.AddFieldDirectly("You don't even have that filter fam", filter); } executedSomething = true; } } if (executedSomething) { embed.AddFieldDirectly("Your Filters are now: ", (user.WarframeFilters.Count == 0 ? "\n\nWell that looks pretty empty" : user.WarframeFilters.Aggregate((x, y) => x + "\n" + y))); DiscordNETWrapper.SendEmbed(embed, message.Channel).Wait(); } else { DiscordNETWrapper.SendEmbed(HelpMenu, message.Channel).Wait(); } } } return; }
List <EmbedBuilder> GetStateEmbeds() { if (WarframeHandler.worldState == null) { return(null); } List <EmbedBuilder> re = new List <EmbedBuilder>(); lock (lockject) { if (WarframeHandler.worldState.WS_Alerts.Count != 0) { EmbedBuilder alerts = new EmbedBuilder(); alerts.WithColor(0, 128, 255); alerts.WithTitle("Alerts:"); alerts.WithDescription(WarframeHandler.worldState.WS_Alerts.Select(x => ToTitle(x)).Aggregate((x, y) => x + "\n" + y)); re.Add(alerts); } if (WarframeHandler.worldState.WS_Invasions.Count != 0) { EmbedBuilder invasions = new EmbedBuilder(); invasions.WithColor(0, 128, 255); invasions.WithTitle("Invasions:"); foreach (Invasion inv in WarframeHandler.worldState.WS_Invasions.Where(x => !x.IsCompleted ?? false)) { invasions.AddFieldDirectly($"{inv.AttackingFaction}({ToTitle(inv.AttackerReward)}) vs. {inv.DefendingFaction}({ToTitle(inv.DefenderReward)})", $"{inv.Node} - {inv.Description} - {inv.Completion}%"); } re.Add(invasions); } if (WarframeHandler.worldState.WS_Fissures.Count != 0) { EmbedBuilder fissures = new EmbedBuilder(); fissures.WithColor(0, 128, 255); fissures.WithTitle("Fissures:"); fissures.WithDescription(WarframeHandler.worldState.WS_Fissures.OrderBy(x => x.TierNumber). Select(f => f.Tier + " - " + f.MissionType + " - " + ToReadable(f.EndTime.ToLocalTime() - DateTime.Now)). Aggregate((x, y) => x + "\n" + y)); re.Add(fissures); } EmbedBuilder voidtrader = new EmbedBuilder(); voidtrader.WithColor(0, 128, 255); if (WarframeHandler.worldState.WS_VoidTrader.Inventory.Count == 0) { voidtrader.WithTitle($"Baro-Senpai is currently gone\nBut don't despair he will come back"); voidtrader.WithTimestamp(WarframeHandler.worldState.WS_VoidTrader.StartTime.ToLocalTime()); } else { voidtrader.WithTitle("Baro-senpai is here :weary:"); foreach (VoidTraderItem item in WarframeHandler.worldState.WS_VoidTrader.Inventory) { voidtrader.AddFieldDirectly(item.Item, $"{item.Credits}:moneybag: {item.Ducats}:regional_indicator_d:"); } voidtrader.WithFooter("He will leave again "); voidtrader.WithTimestamp(WarframeHandler.worldState.WS_VoidTrader.EndTime.ToLocalTime()); } re.Add(voidtrader); if (WarframeHandler.worldState.WS_NightWave?.ActiveChallenges.Count > 0) { EmbedBuilder nightwave = new EmbedBuilder(); nightwave.WithColor(0, 128, 255); nightwave.WithTitle($"Nightwave Challenges: "); nightwave.WithDescription($"Season {WarframeHandler.worldState.WS_NightWave.Season} Phase " + $"{WarframeHandler.worldState.WS_NightWave.Phase}"); foreach (NightwaveChallenge x in WarframeHandler.worldState.WS_NightWave.ActiveChallenges) { nightwave.AddFieldDirectly($"{(x.IsDaily ?? false ? "[Daily] " : "")}{(x.IsElite ?? false ? "[Elite] " : "")}{x.Title} - {x.Desc}", $"{x.Reputation} :arrow_up: until {x.Expiry}"); } re.Add(nightwave); } if (WarframeHandler.worldState.WS_Sortie?.Variants.Count > 0) { EmbedBuilder sortie = new EmbedBuilder(); sortie.WithColor(0, 128, 255); sortie.WithTitle("Sortie:"); sortie.WithDescription(WarframeHandler.worldState.WS_Sortie.Variants. Select(x => x.MissionType + " on " + x.Node + " with " + x.Modifier + "\n" + x.ModifierDescription). Aggregate((x, y) => x + "\n\n" + y)); re.Add(sortie); } if (WarframeHandler.worldState.WS_Events?.Count > 0) { EmbedBuilder events = new EmbedBuilder(); events.WithColor(0, 128, 255); events.WithTitle("Events:"); events.WithDescription(WarframeHandler.worldState.WS_Events. Select(x => x.Description + " - Until: " + x.EndTime.ToLongDateString() + " - " + x.Rewards. Select(y => ToTitle(y)). Foldl("", (a, b) => a + " " + b).Trim(' ').Trim('-')). Foldl("", (x, y) => x + "\n" + y)); re.Add(events); } { EmbedBuilder cycles = new EmbedBuilder(); cycles.WithColor(0, 128, 255); cycles.WithTitle("Cycles:"); cycles.AddFieldDirectly("Cetus: ", WarframeHandler.worldState.WS_CetusCycle.TimeOfDay() + " " + ToReadable(WarframeHandler.worldState.WS_CetusCycle.Expiry.ToLocalTime() - DateTime.Now)); cycles.AddFieldDirectly("Fortuna: ", WarframeHandler.worldState.WS_FortunaCycle.Temerature() + " " + ToReadable(WarframeHandler.worldState.WS_FortunaCycle.Expiry.ToLocalTime() - DateTime.Now)); re.Add(cycles); } { EmbedBuilder syndicates = new EmbedBuilder(); syndicates.WithColor(0, 128, 255); syndicates.WithTitle("Syndicate Missions: "); foreach (SyndicateMission mission in WarframeHandler.worldState.WS_SyndicateMissions.Where(x => x.jobs != null && x.jobs.Count > 0)) { syndicates.AddFieldDirectly(mission.Syndicate, "Missions: "); for (int i = 0; i < mission.jobs.Count; i++) { if (mission.jobs[i].rewardPool != null) { syndicates.AddFieldDirectly("Mission #" + (i + 1), $"{mission.jobs[i].rewardPool.Aggregate((x, y) => y == "" ? x : x + ", " + y)} and " + $"{mission.jobs[i].standingStages.Sum()} :arrow_up: until {mission.EndTime.ToLocalTime().ToLongTimeString()}"); } } } re.Add(syndicates); } } return(re); }
public override void Execute(IMessage commandmessage) { if (!(commandmessage is SocketMessage)) { return; } var message = commandmessage as SocketMessage; if (message.Content.Split(new char[] { ' ', '\n' }).Length < 2 || message.Content.Split(new char[] { ' ', '\n' })[1] == "help") { EmbedBuilder Embed = new EmbedBuilder(); Embed.WithColor(0, 128, 255); Embed.AddFieldDirectly(Prefix + CommandLine + " newGame + a mentioned user", "Creates a new game against the mentioned user"); Embed.AddFieldDirectly(Prefix + CommandLine + " set + coordinates", "Sets your symbol at the specified coordinates in the form of \"1,2\" " + "no spaces allowed eg. " + Prefix + CommandLine + " set 2,3\nWarning for Computer Science people: coordinates start at 1!"); Embed.AddFieldDirectly(Prefix + CommandLine + " game", "Prints the game you are currently in"); Embed.WithDescription("TicTacToe Commands:"); DiscordNETWrapper.SendEmbed(Embed, message.Channel).Wait(); } else if (message.Content.Split(new char[] { ' ', '\n' })[1] == "newGame") { if (message.MentionedUsers.Count < 1 || message.MentionedUsers.Count > 1) { DiscordNETWrapper.SendText("You need exactly one player to play against!", message.Channel).Wait(); } else { if (Games.Exists(x => x.Player1 == message.MentionedUsers.ElementAt(0)) || Games.Exists(x => x.Player2 == message.MentionedUsers.ElementAt(0))) { DiscordNETWrapper.SendText(message.MentionedUsers.ElementAt(0).Mention + " is already in a game.", message.Channel).Wait(); } else if (Games.Exists(x => x.Player1 == message.Author) || Games.Exists(x => x.Player2 == message.Author)) { DiscordNETWrapper.SendText("You are already in a game.", message.Channel).Wait(); } else { if (message.MentionedUsers.ElementAt(0).IsBot) { if (message.MentionedUsers.ElementAt(0).Id == Program.GetSelf().Id) { DiscordNETWrapper.SendText("You will be able to play against me once my master teaches me the game!", message.Channel).Wait(); } else { DiscordNETWrapper.SendText("You cant play with a bot!", message.Channel).Wait(); } } else { if (message.MentionedUsers.ElementAt(0).Id == message.Author.Id) { DiscordNETWrapper.SendText("You can't play against yourself!", message.Channel).Wait(); } else { Games.Add(new TicTacToeGame(message.MentionedUsers.ElementAt(0), message.Author)); DiscordNETWrapper.SendText("Created new game against " + message.MentionedUsers.ElementAt(0) + " successfully!", message.Channel).Wait(); DiscordNETWrapper.SendText(Games.Last().ToString(), message.Channel).Wait(); } } } } } else if (message.Content.Split(new char[] { ' ', '\n' })[1] == "set") { TicTacToeGame Game = null; try { Game = Games.Find(x => x.Player1 == message.Author || x.Player2 == message.Author); } catch { } if (Game == null) { DiscordNETWrapper.SendText("You are not in a game!", message.Channel).Wait(); } else { if (message.Content.Split(new char[] { ' ', '\n' }).Length < 3) { DiscordNETWrapper.SendText("Where are the coordinates?!", message.Channel).Wait(); } else { if (message.Author == Game.Player1 && !Game.Player1sTurn || message.Author == Game.Player2 && Game.Player1sTurn) { DiscordNETWrapper.SendText("Its not your turn!", message.Channel).Wait(); } else { byte x = 255, y = 255; try { string coords = message.Content.Split(new char[] { ' ', '\n' })[2]; string[] xy = coords.Split(','); x = Convert.ToByte(xy[0]); y = Convert.ToByte(xy[1]); if (x == 0 || y == 0) { DiscordNETWrapper.SendText("You cant put your symbol there!\nRemember Coordinates start at 1, not 0.", message.Channel).Wait(); return; } x--; y--; } catch { DiscordNETWrapper.SendText("The coordinates Mason what do they mean?!", message.Channel).Wait(); } if (Game.Field[x, y] == 0 && x < 3 && y < 3) { Game.Player1sTurn = !Game.Player1sTurn; if (message.Author == Game.Player1) { Game.Field[x, y] = 1; } else { Game.Field[x, y] = 2; } DiscordNETWrapper.SendText(Game.ToString(), message.Channel).Wait(); if (Game.Draw()) { DiscordNETWrapper.SendText("Draw between " + Game.Player1.Mention + " and " + Game.Player2.Mention + "!", message.Channel).Wait(); Games.Remove(Game); } SocketUser Won = Game.PlayerWon(); if (Won == Game.Player1) { DiscordNETWrapper.SendText("The meatbag called " + Game.Player1.Mention + " won!", message.Channel).Wait(); Games.Remove(Game); } else if (Won == Game.Player2) { DiscordNETWrapper.SendText("The meatbag called " + Game.Player2.Mention + " won!", message.Channel).Wait(); Games.Remove(Game); } } else { DiscordNETWrapper.SendText("You cant put your symbol there!", message.Channel).Wait(); } } } } } else if (message.Content.Split(new char[] { ' ', '\n' })[1] == "game" || message.Content.Split(new char[] { ' ', '\n' })[1] == "Game") { TicTacToeGame Game = null; try { Game = Games.Find(x => x.Player1 == message.Author || x.Player2 == message.Author); } catch { } if (Game == null) { DiscordNETWrapper.SendText("You are in no game!", message.Channel).Wait(); } else { DiscordNETWrapper.SendText(Game.ToString(), message.Channel).Wait(); } } }
public override void Execute(IMessage message) { string idText = message.Content.Split(' ').Last().Split('/').Last(); IMessage m; try { m = message.Channel.GetMessageAsync(Convert.ToUInt64(idText)).Result; } catch { DiscordNETWrapper.SendText("That's not a valid message id", message.Channel).Wait(); return; } EmbedBuilder embed = DiscordNETWrapper.CreateEmbedBuilder("", m.Content, "", m.Author); embed.AddFieldDirectly("Created at:", m.CreatedAt, true); embed.AddFieldDirectly("Sent at:", m.Timestamp, true); if (m.EditedTimestamp != null) { embed.AddFieldDirectly("Edited at:", m.EditedTimestamp, true); } if (m.Activity != null) { embed.AddFieldDirectly("Activity:", m.Activity, true); } if (m.Application != null) { embed.AddFieldDirectly("Application:", m.Application, true); } embed.AddFieldDirectly("IsPinned:", m.IsPinned, true); embed.AddFieldDirectly("IsTTS:", m.IsTTS, true); embed.AddFieldDirectly("ID:", m.Id, true); embed.AddFieldDirectly("Source:", m.Source, true); embed.AddFieldDirectly("Tags:", m.Tags.Count, true); embed.AddFieldDirectly("Type:", m.Type, true); try { embed.AddFieldDirectly("Emotes:", m.Content.GetEverythingBetweenAll("<", ">"). Select(x => Emote.TryParse($"<{x}>", out Emote e) ? e : null). Where(x => x != null). Select(x => x.Url). Combine("\n")); } catch { } DiscordNETWrapper.SendEmbed(embed, message.Channel).Wait(); }
public override void Execute(IMessage message) { string idText = message.Content.Split(' ').Last().Trim('<', '>', '@'); SocketUser u; try { u = Program.GetUserFromId(ulong.Parse(idText)); } catch { DiscordNETWrapper.SendText("That's not a valid user id", message.Channel).Wait(); return; } EmbedBuilder embed = DiscordNETWrapper.CreateEmbedBuilder(u.Username, "", u.GetAvatarUrl(), u, u.GetDefaultAvatarUrl()); embed.AddFieldDirectly("Activities", u.Activities.Select(x => $"{x.Name}, {x.Type}").Combine(" - ")); embed.AddFieldDirectly("AvatarId", u.AvatarId); embed.AddFieldDirectly("CreatedAt", u.CreatedAt); embed.AddFieldDirectly("Discriminator", u.Discriminator); embed.AddFieldDirectly("DiscriminatorValue", u.DiscriminatorValue); embed.AddFieldDirectly("Id", u.Id); embed.AddFieldDirectly("IsBot", u.IsBot); embed.AddFieldDirectly("IsWebhook", u.IsWebhook); embed.AddFieldDirectly("Mention", u.Mention); embed.AddFieldDirectly("MutualGuilds", u.MutualGuilds.Select(x => $"({x.Name}, {x.Id}) by {x.Owner.Username}").Combine("\n")); embed.AddFieldDirectly("Status", u.Status); DiscordNETWrapper.SendEmbed(embed, message.Channel).Wait(); }