Esempio n. 1
0
        public async Task InfoAsync(EventContext e)
        {
            IDiscordEmbed embed  = Utils.Embed;
            Locale        locale = new Locale(e.Channel.Id);

            embed.Author      = embed.CreateAuthor();
            embed.Author.Name = "Miki " + Bot.Instance.Information.Version;
            embed.SetColor(0.6f, 0.6f, 1.0f);

            embed.AddField(locale.GetString("miki_module_general_info_made_by_header"),
                           locale.GetString("miki_module_general_info_made_by_description") + " Drummss, Fuzen, IA, Luke, Milk, n0t, Phanrazak, Rappy, Tal, Vallode, GrammarJew");


            embed.AddField(e.GetResource("miki_module_general_info_links"),
                           $"`{locale.GetString("miki_module_general_info_docs").PadRight(15)}:` [documentation](https://www.github.com/velddev/miki/wiki)\n" +
                           $"`{"donate".PadRight(15)}:` [patreon](https://www.patreon.com/mikibot) | [ko-fi](https://ko-fi.com/velddy)\n" +
                           $"`{locale.GetString("miki_module_general_info_twitter").PadRight(15)}:` [veld](https://www.twitter.com/velddev) | [miki](https://www.twitter.com/miki_discord)\n" +
                           $"`{locale.GetString("miki_module_general_info_reddit").PadRight(15)}:` [/r/mikibot](https://www.reddit.com/r/mikibot) \n" +
                           $"`{locale.GetString("miki_module_general_info_server").PadRight(15)}:` [discord](https://discord.gg/55sAjsW)\n" +
                           $"`{locale.GetString("miki_module_general_info_website").PadRight(15)}:` [link](https://miki.ai)");

            embed.QueueToChannel(e.Channel);

            await Task.Yield();
        }
Esempio n. 2
0
        public async Task WhoIsAsync(EventContext e)
        {
            ulong id = 0;

            if (string.IsNullOrEmpty(e.arguments))
            {
                id = e.Author.Id;
            }
            else if (e.message.MentionedUserIds.Count == 0)
            {
                id = ulong.Parse(e.arguments);
            }
            else
            {
                id = e.message.MentionedUserIds.First();
            }

            IDiscordUser user = await e.Guild.GetUserAsync(id);

            Locale l = new Locale(e.Channel.Id);

            IDiscordEmbed embed = Utils.Embed;

            embed.Title = $"Who is {(string.IsNullOrEmpty(user.Nickname) ? user.Username : user.Nickname)}!?";
            embed.SetColor(0.5f, 0f, 1.0f);

            embed.ImageUrl = (await e.Guild.GetUserAsync(id)).AvatarUrl;

            embed.AddInlineField(
                l.GetString("miki_module_whois_tag_personal"),
                $"User Id      : **{user.Id}**\nUsername: **{user.Username}#{user.Discriminator} {(string.IsNullOrEmpty(user.Nickname) ? "" : $"({user.Nickname})")}**\nCreated at: **{user.CreatedAt.ToString()}**\nJoined at   : **{user.JoinedAt.ToString()}**\n");
Esempio n. 3
0
        public async Task HelpAsync(EventContext e)
        {
            Locale locale = new Locale(e.Channel.Id);

            if (!string.IsNullOrEmpty(e.arguments))
            {
                ICommandEvent ev = EventSystem.Instance.CommandHandler.GetCommandEvent(e.arguments);

                if (ev == null)
                {
                    IDiscordEmbed helpListEmbed = Utils.Embed;
                    helpListEmbed.Title       = locale.GetString("miki_module_help_error_null_header");
                    helpListEmbed.Description = locale.GetString("miki_module_help_error_null_message", await EventSystem.Instance.GetPrefixInstance(">").GetForGuildAsync(e.Guild.Id));
                    helpListEmbed.SetColor(0.6f, 0.6f, 1.0f);

                    API.StringComparison.StringComparer   comparer = new API.StringComparison.StringComparer(e.commandHandler.GetAllEventNames());
                    API.StringComparison.StringComparison best     = comparer.GetBest(e.arguments);

                    helpListEmbed.AddField(locale.GetString("miki_module_help_didyoumean"), best.text);

                    helpListEmbed.QueueToChannel(e.Channel);
                }
                else
                {
                    if (EventSystem.Instance.CommandHandler.GetUserAccessibility(e.message) < ev.Accessibility)
                    {
                        return;
                    }

                    IDiscordEmbed explainedHelpEmbed = Utils.Embed
                                                       .SetTitle(ev.Name.ToUpper());

                    if (ev.Aliases.Length > 0)
                    {
                        explainedHelpEmbed.AddInlineField(
                            locale.GetString("miki_module_general_help_aliases"),
                            string.Join(", ", ev.Aliases));
                    }

                    explainedHelpEmbed.AddField(
                        locale.GetString("miki_module_general_help_description"),
                        (locale.HasString("miki_command_description_" + ev.Name.ToLower())) ? locale.GetString("miki_command_description_" + ev.Name.ToLower()) : locale.GetString("miki_placeholder_null"));

                    explainedHelpEmbed.AddField(
                        locale.GetString("miki_module_general_help_usage"),
                        (locale.HasString("miki_command_usage_" + ev.Name.ToLower())) ? locale.GetString("miki_command_usage_" + ev.Name.ToLower()) : locale.GetString("miki_placeholder_null"));

                    explainedHelpEmbed.QueueToChannel(e.Channel);
                }
                return;
            }
            IDiscordEmbed embed = Utils.Embed;

            embed.Description = locale.GetString("miki_module_general_help_dm");

            embed.SetColor(0.6f, 0.6f, 1.0f);

            embed.QueueToChannel(e.Channel);

            (await EventSystem.Instance.ListCommandsInEmbedAsync(e.message)).QueueToUser(e.Author);
        }