Ejemplo n.º 1
0
        public async Task ServerInfo()
        {
            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();
            var server = Context.Guild;

            if (server is null)
            {
                await ReplyAsync("Looks like we aren't in a server.");
                return;
            }

            embedBuilder.WithAuthor(server.Name, server.IconUrl);
            embedBuilder.AddField("General",
                $"**Created**: {server.CreatedAt}\n" +
                $"**Owner**: {server.Owner}\n" +
                $"**Members**: {server.MemberCount}\n");

            embedBuilder.AddField("Misc. Information",
                $"**Text Channels**: {server.TextChannels.Count}\n" +
                $"**Roles**: {server.Roles.Count}\n" +
                $"**Emotes**: {server.Emotes.Count}\n" +
                $"**Content Filter**: {server.ExplicitContentFilter}\n" +
                $"**Server Boost Level**: {server.PremiumTier}");

            await ReplyAsync(embed: embedBuilder.Build());
        }
Ejemplo n.º 2
0
        public async Task Leaderboard()
        {
            var embedBuilder          = MessagingUtils.GetShrimpbotEmbedBuilder();
            List <DatabaseUser> users = Database.GetAllUsers();

            if (users.Count >= 10)
            {
                users = users.GetRange(0, 10).OrderByDescending(o => o.Money).ToList();
            }
            else
            {
                users = users.OrderByDescending(o => o.Money).ToList();
            }
            var stringBuilder = new StringBuilder();
            int i             = 1;

            foreach (var user in users)
            {
                string userx = Client.Rest.GetUserAsync(user.Id).Result.Username;
                if (userx == Context.User.Username)
                {
                    userx = $"**{userx}**";
                }
                stringBuilder.AppendLine($"{i} - {userx}: {Config.CurrencySymbol}{string.Format("{0:n}", user.Money)}");
                i++;
            }

            embedBuilder.AddField($"Top {Config.Name} users", stringBuilder.ToString());
            await ReplyAsync(embed : embedBuilder.Build());
        }
Ejemplo n.º 3
0
        public async Task UserInfo(IUser? runner = null)
        {
            DatabaseUser databaseUser;
            if (runner is null) databaseUser = Database.GetUser(Context.User.Id); else databaseUser = Database.GetUser(runner.Id);
            var user = Client.GetUser(databaseUser.Id);
            var guildUser = Context.Guild?.GetUser(databaseUser.Id);

            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();
            embedBuilder.WithAuthor(user);
            embedBuilder.WithDescription(user.Status.ToString());

            embedBuilder.AddField("General",
                $"**User ID**: {user.Id}\n" +
                $"**Created**: {user.CreatedAt}\n" +
                $"**Human?**: {!user.IsBot}");

            if (guildUser != null) embedBuilder.AddField("This Server",
                $"**Nickname**: {guildUser.Nickname}\n" +
                $"**Joined**: {guildUser.JoinedAt}\n");

            embedBuilder.AddField("ShrimpBot",
                $"**Money**: {Config.CurrencySymbol}{databaseUser.Money}\n" +
                $"**Cuteness**: {databaseUser.Cuteness}\n" +
                $"**Bot Permission Level**: {databaseUser.BotPermissions}\n");

            await ReplyAsync(embed: embedBuilder.Build());
        }
Ejemplo n.º 4
0
        public async Task Timers()
        {
            var timers = RuntimeInformation.Timers.RunningTimers.Where(x => x.CreatorID == Context.User.Id);

            if (!timers.Any())
            {
                await ReplyAsync("You don't have any running timers.");

                return;
            }

            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();

            embedBuilder.WithTitle("Your running timers");
            embedBuilder.WithAuthor(Context.User);
            int i = 1;

            foreach (var timer in timers)
            {
                embedBuilder.AddField($"Timer #{i}",
                                      $"**Elapses**: {MessagingUtils.GetLengthString(timer.Elapses - DateTime.UtcNow)}\n" +
                                      $"**Message**: {timer.Message}", inline: true);
                i++;
            }
            await ReplyAsync(embed : embedBuilder.Build());
        }
Ejemplo n.º 5
0
        public async Task UserPicture(IUser? person = null)
        {
            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();
            var imagePath = (person ?? Context.User).GetAvatarUrl(size: 1024);

            embedBuilder.WithImageUrl(imagePath);
            await ReplyAsync(embed: embedBuilder.Build());
        }
Ejemplo n.º 6
0
        public async Task Stats()
        {
            var uptime       = DateTime.Now - RuntimeInformation.StartupTime;
            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();

            embedBuilder.AddField($"{Config.Name} stats",
                                  $"Uptime: {uptime}\n" +
                                  $"Commands handled: {RuntimeInformation.CommandsHandled}");
            await ReplyAsync(embed : embedBuilder.Build());
        }
Ejemplo n.º 7
0
        public async Task Help(string search = null)
        {
            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();

            if (search is null)
            {
                List <ModuleInfo> modules = CommandService.Modules.OrderBy(x => x.Name).ToList();
                foreach (ModuleInfo module in modules)
                {
                    if (module.Name == "Bot Management")
                    {
                        continue;
                    }
                    string summary = $"{module.Summary}\r\n\r\n";

                    summary += string.Join(", ", module.Commands.Select(x => x.Name));
                    embedBuilder.AddField(module.Name, summary, inline: true);
                }
                await ReplyAsync(
                    ":information_source: **Shrimpbot Help**\n" +
                    $"To get more information about a category or command, type {Config.Prefix}help [category].", false, embedBuilder.Build());
            }
            else
            {
                ModuleInfo module = CommandService.Modules.FirstOrDefault(x => x.Name.ToLower().StartsWith(search.ToLower()));
                if (module is null)
                {
                    CommandInfo info = CommandService.Commands.FirstOrDefault(y => y.Name.ToLower().StartsWith(search.ToLower()));
                    if (info is null)
                    {
                        await ReplyAsync($"{MessagingUtils.InvalidParameterEmote} The category or commandyou tried to search for doesn't seem to exist.");

                        return;
                    }
                    embedBuilder.Title       = info.Name;
                    embedBuilder.Description = info.Summary ?? "No description";
                    if (!string.IsNullOrEmpty(info.Remarks))
                    {
                        embedBuilder.AddField("Parameters", info.Remarks);
                    }
                    await ReplyAsync(":information_source: **ShrimpBot Help**", embed : embedBuilder.Build());

                    return;
                }
                string summary = $"{module.Summary}\r\n\r\n";
                foreach (CommandInfo command in module.Commands)
                {
                    summary += $"__{command.Name}__ - {command.Summary ?? "No description"}\n";
                }
                embedBuilder.AddField(module.Name, summary, inline: true);
                await ReplyAsync(":information_source: **Shrimpbot Help**", embed : embedBuilder.Build());
            }
        }
Ejemplo n.º 8
0
        public EmbedBuilder GetFormattedCurrentPage(IUser user)
        {
            var builder = MessagingUtils.GetShrimpbotEmbedBuilder();

            builder.WithAuthor(user);
            builder.AddField(CurrentPage.PropertyName,
                             $"{CurrentPage.PropertyDescription}\n\n" +
                             $"Type...\n" +
                             $"{CurrentPage.Prompt}\n" +
                             $"to set this property.");
            builder.WithFooter($"'quit' - Exit; 'back' - Back");
            return(builder);
        }
Ejemplo n.º 9
0
        public async Task TypeRace()
        {
            var paragraph = FunService.GetRandomParagraph();
            var wordCount = paragraph.Length / 5; // words in typing are 5 letters, regardless of the actual words
            var startTime = DateTime.Now;
            var builder   = MessagingUtils.GetShrimpbotEmbedBuilder()
                            .WithAuthor(Context.User)
                            .WithTitle($"You have (placeholder) minutes to type this thing! glhf")
                            .WithDescription(paragraph)
                            .WithFooter($"quit - Exit");

            await ReplyAsync(embed : builder.Build());

            while (true)
            {
                var response = await NextMessageAsync(timeout : new TimeSpan(0, 0, 0, 0, -1));

                if (response.Content == paragraph)
                {
                    var timeTaken = DateTime.Now - startTime;
                    var wpm       = wordCount / timeTaken.TotalMinutes;
                    if (timeTaken.TotalMilliseconds <= wordCount * 200)
                    {
                        await ReplyAsync($"I CAN SEE THROUGH YOUR BS YOU HACKER");

                        continue;
                    }
                    await ReplyAsync($"Congrats! You took {timeTaken:mm\\:ss} and typed {Math.Round(wpm)} wpm.");

                    return;
                }
                else if (response.Content == "quit")
                {
                    await ReplyAsync("You quit.");

                    return;
                }
                else
                {
                    await ReplyAsync("Looks like you made a mistake.");
                }
            }
        }
Ejemplo n.º 10
0
        public async Task About()
        {
            var embedBuilder = MessagingUtils.GetShrimpbotEmbedBuilder();

            embedBuilder.ImageUrl = "https://cdn.discordapp.com/attachments/556283742008901645/600468110109048837/Banner.png";
            embedBuilder.AddField($"{Config.Name} {Assembly.GetEntryAssembly().GetName().Version}", "by Squid Grill (and open source contributors)");
            embedBuilder.AddField("Hosting",
                                  $"{System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}\n" +
                                  $"Discord.NET {DiscordConfig.Version}\n" +
                                  $"{Environment.OSVersion.VersionString}"
                                  );
            embedBuilder.AddField("Links",
                                  "Official ShrimpBot Discord Server: https://discord.gg/fuJ6J4s\n" +
                                  "GitHub Repository: https://github.com/Royce551/ShrimpBot");
            embedBuilder.WithFooter("Thank you for using ShrimpBot! ❤");
            await Client.CurrentUser.ModifyAsync(x => x.Username = Config.Name);

            await ReplyAsync(null, false, embedBuilder.Build());
        }
Ejemplo n.º 11
0
        public EmbedBuilder GetFormattedBoard(IUser user)
        {
            var builder       = MessagingUtils.GetShrimpbotEmbedBuilder().WithAuthor(user).WithDescription($"Turn {Turns}");
            var stringBuilder = new StringBuilder();
            int lastYPos      = 0;

            for (int y = 0; y < Board.GetLength(1); y++)
            {
                for (int x = 0; x < Board.GetLength(0); x++)
                {
                    stringBuilder.Append(Board[x, y].Emote);
                    if (y != lastYPos)
                    {
                        stringBuilder.AppendLine();
                    }
                }
                lastYPos = y;
            }
            builder.AddField($"Turn {Turns}", stringBuilder.ToString());
            return(builder);
        }
Ejemplo n.º 12
0
        public EmbedBuilder GetFormattedStatus(IUser user)
        {
            var builder = MessagingUtils.GetShrimpbotEmbedBuilder();

            builder.WithAuthor(user);
            if (!InBlitzMode)
            {
                builder.WithDescription($"{Protagonist.Emote}\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\_\\__{Enemy.Emote}\n**Turn {Turns}**");
            }
            else
            {
                builder.WithDescription($"{Protagonist.Emote}🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥{Enemy.Emote}\n**Turn {Turns}**\n**In blitz mode! Healing magic is banned!**");
            }
            builder.AddField(Protagonist.Name,
                             $":blue_heart: **Health**: {Protagonist.Health}\n" +
                             $":magic_wand: **Mana**: {Protagonist.Mana}\n");
            builder.AddField(Enemy.Name,
                             $":hearts: **Health**: {Enemy.Health}\n" +
                             $":magic_wand: **Mana**: {Enemy.Mana}\n");
            builder.WithFooter("a - Attack; m - Use offensive magic; h - Use healing magic; f or quit - Flee");
            return(builder);
        }