Exemplo n.º 1
0
        public async Task SendMessageAsync(MiunieChannel mc, PhraseKey phraseKey, params object[] parameters)
        {
            var channel = _discord.Client.GetChannel(mc.ChannelId) as SocketTextChannel;
            var msg     = _lang.GetPhrase(phraseKey.ToString(), parameters);

            _ = await channel.SendMessageAsync(msg);
        }
Exemplo n.º 2
0
 public static Embed ToEmbed(this MiunieGuild mGuild, ILanguageProvider lang)
 => new EmbedBuilder()
 .WithColor(new Color(236, 64, 122))
 .WithTitle(lang.GetPhrase(PhraseKey.GUILD_EMBED_TITLE.ToString()))
 .AddField(lang.GetPhrase(PhraseKey.GUILD_EMBED_NAME_TITLE.ToString()), mGuild.Name)
 .AddField(lang.GetPhrase(PhraseKey.GUILD_EMBED_STATS_TITLE.ToString()), mGuild.GetStats(), true)
 .AddField(lang.GetPhrase(PhraseKey.GUILD_EMBED_ROLES_TITLE.ToString()), string.Join(", ", mGuild.Roles.Select(r => r.Name.Replace("@", ""))), true)
 .AddField(lang.GetPhrase(PhraseKey.GUILD_EMBED_CREATED_AT_TITLE.ToString()), $"{mGuild.CreationDate:d} at {mGuild.CreationDate:t} UTC")
 .Build();
Exemplo n.º 3
0
        public static Embed CreateReputationLog(IEnumerable <ReputationEntry> entries, int index, ILanguageProvider lang)
        {
            var embed = Paginator.PaginateEmbed(entries, new EmbedBuilder()
                                                .WithColor(new Color(236, 64, 122))
                                                .WithTitle(lang.GetPhrase(PhraseKey.USER_EMBED_REP_LOG_TITLE.ToString())),
                                                index,
                                                REP_LOG_PAGE_SIZE,
                                                x => $"{(x.IsFromInvoker ? "**To:**" : "**From:**")} {x.TargetName} (**{FormatReputationType(x.Type)}**) {x.GivenAt:d} at {x.GivenAt:t} UTC");

            if (string.IsNullOrWhiteSpace(embed.Description))
            {
                embed.WithDescription(lang.GetPhrase(PhraseKey.USER_EMBED_REP_LOG_EMPTY.ToString()));
            }

            return(embed.Build());
        }
Exemplo n.º 4
0
        public async Task SendMessage(MiunieChannel mc, PhraseKey phraseKey, params object[] parameters)
        {
            var channel = await _discordClient.GetChannelAsync(mc.ChannelId);

            var msg = _lang.GetPhrase(phraseKey.ToString(), parameters);
            await channel.SendMessageAsync(msg);
        }
Exemplo n.º 5
0
        public static Embed ToEmbed(this MiunieUser mUser, ILanguageProvider lang)
        {
            var realnessPhrase = lang.GetPhrase((mUser.IsBot ? PhraseKey.USER_EMBED_IS_BOT : PhraseKey.USER_EMBED_IS_HUMAN).ToString());

            return(new EmbedBuilder()
                   .WithColor(new Color(236, 64, 122))
                   .WithTitle(lang.GetPhrase(PhraseKey.USER_EMBED_TITLE.ToString()))
                   .WithThumbnailUrl(mUser.AvatarUrl)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_NAME_TITLE.ToString()), mUser.Name)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_REALNESS_TITLE.ToString()), realnessPhrase, true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_REP_TITLE.ToString()), mUser.Reputation.Value.ToString(), true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_ROLES_TITLE.ToString()), string.Join("\n", mUser.Roles.Select(r => r.Name)), true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_JOINED_AT_TITLE.ToString()), $"{mUser.JoinedAt:d} at {mUser.JoinedAt:t} UTC")
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_CREATED_AT_TITLE.ToString()), $"{mUser.CreatedAt:d} at {mUser.CreatedAt:t} UTC", true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_TIME_TITLE.ToString()), mUser.UtcTimeOffset.HasValue ? lang.GetPhrase(PhraseKey.USER_EMBED_TIME.ToString(), DateTime.UtcNow + mUser.UtcTimeOffset) : lang.GetPhrase(PhraseKey.USER_EMBED_TIME_NOSET.ToString()), true)
                   .Build());
        }
Exemplo n.º 6
0
        public static DiscordEmbed ToEmbed(this MiunieUser mUser, ILanguageProvider lang)
        {
            var realnessPhrase = lang.GetPhrase((mUser.IsBot ? PhraseKey.USER_EMBED_IS_BOT : PhraseKey.USER_EMBED_IS_HUMAN).ToString());

            return(new DiscordEmbedBuilder()
                   .WithColor(new DiscordColor("#EC407A"))
                   .WithTitle(lang.GetPhrase(PhraseKey.USER_EMBED_TITLE.ToString()))
                   .WithThumbnailUrl(mUser.AvatarUrl)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_NAME_TITLE.ToString()), mUser.Name)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_REALNESS_TITLE.ToString()), realnessPhrase, true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_REP_TITLE.ToString()), mUser.Reputation.Value.ToString(), true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_ROLES_TITLE.ToString()), string.Join("\n", mUser.Roles.Select(r => r.Name)), true)
                   .AddField(lang.GetPhrase(PhraseKey.USER_EMBED_JOINED_AT_TITLE.ToString()), $"{mUser.JoinedAt:d} at {mUser.JoinedAt:t} UTC")
                   .Build());
        }
Exemplo n.º 7
0
 public HelpResult ForAllCommands()
 => new HelpResult
 {
     Title    = _lang.GetPhrase(PhraseKey.USER_EMBED_HELP_TITLE.ToString()),
     Sections = _commandService.Modules.Select(x => GetSection(x))
 };