public async Task Translate(CommandContext context, string input, string target = "en")
        {
            if (Program.Flags["translate"])
            {
                var result = await Translation.TranslateAsync(input, target);

                var builder = new MaterialEmbedBuilder(context.Client);
                builder.WithTitle("Translator", "translate");
                builder.WithFooter($"Google Translate • {result.SourceLanguage} -> {result.TargetLanguage}", "https://i.imgur.com/hOZBVvU.png");
                builder.WithText(result.TranslatedText);
                await context.RespondAsync(embed : builder.Build());
            }
            else
            {
                await context.RespondAsync("The translation debug flag has not been enabled.");
            }
        }
Example #2
0
            public async Task Info(CommandContext context)
            {
                var builder = new MaterialEmbedBuilder(context.Client);

                _ = builder.WithTitle(context.Client.CurrentUser.Username + " / Bot Info", context.Client.CurrentUser.AvatarUrl);

                builder.AddSection(null, "General",
                                   new MaterialEmbedListTile(
                                       "discord",
                                       $"[{await context.GetStringAsync("Bot_Info_DSharpPlusVersion")}](https://github.com/DSharpPlus/DSharpPlus/)",
                                       context.Client.VersionString),

                                   new MaterialEmbedListTile(
                                       "account-star",
                                       await context.GetStringAsync("Bot_Info_Creator"),
                                       "<@!194891941509332992>"),

                                   new MaterialEmbedListTile(
                                       "help-circle",
                                       await context.GetStringAsync("Bot_Info_HelpCommand"),
                                       $"`{context.Prefix}help`")
                                   );

                builder.AddSection(null, await context.GetStringAsync("Bot_Info_Statistics"),
                                   new MaterialEmbedListTile(
                                       "clock-fast",
                                       await context.GetStringAsync("Bot_Info_Uptime"),
                                       (DateTime.UtcNow - Process.GetCurrentProcess().StartTime.ToUniversalTime()).ToConversationalString()),

                                   new MaterialEmbedListTile(
                                       "blank",
                                       await context.GetStringAsync("Bot_Info_Commands"),
                                       context.Client.GetExtension <CommandsNextExtension>().RegisteredCommands.Count.ToString()),

                                   new MaterialEmbedListTile(
                                       "blank",
                                       await context.GetStringAsync("Bot_Info_Servers"),
                                       context.Client.Guilds.Count.ToString())
                                   );

                builder.WithText($"[{"github-circle".GetEmojiString()}](https://github.com/Craftplacer/CraftBot) [{"earth".GetEmojiString()}](https://craftplacer.trexion.com/projects/craftbot)");

                _ = await context.Message.RespondAsync(embed : builder.Build());
            }