Esempio n. 1
0
        public Task TuneIn(bool ping = false)
        {
            Random     rand    = new Random();
            SocketRole theRole = Context.Guild.Roles.Where(x => x.Id == Admins.AdminId).FirstOrDefault();

            Admin admin = Admins.GetAdminById(Context.User.Id);

            if (admin == null)
            {
                return(ReplyAsync(embed: GetErrorEmbed().WithDescription($"**{Context.User.Username}** is not a {theRole.Name}").Build()));
            }
            if (admin.Phrases.Count == 0)
            {
                return(ReplyAsync(embed: GetErrorEmbed().WithDescription($"**{Context.User.Username}** does not have any phrases").Build()));
            }

            var embed = new EmbedBuilder()
            {
                Title  = admin.Phrases[rand.Next(0, admin.Phrases.Count)],
                Author = new EmbedAuthorBuilder()
                {
                    IconUrl = Context.User.GetAvatarUrl(), Name = admin.Nickname ?? admin.Username
                },
                Color = Color.Orange
            };

            return(ReplyAsync(message: ping?theRole.Mention: "", embed: embed.Build()));
        }
Esempio n. 2
0
        public Task GetPhrases()
        {
            Admin user  = Admins.GetAdminById(Context.User.Id);
            var   embed = new EmbedBuilder()
            {
                Title        = $"{user.Nickname ?? user.Username}'s Phrases",
                ThumbnailUrl = Context.User.GetAvatarUrl(),
                Color        = Color.Orange,
            };

            if (user.Phrases == null)
            {
                return(ReplyAsync(embed: GetErrorEmbed().WithDescription($"{Context.User.Username} does not have any phrases").Build()));
            }

            for (int i = 0; i < user.Phrases.Count; i++)
            {
                string phrase = user.Phrases[i];
                embed.AddField($"[{i}]", phrase);
            }
            return(ReplyAsync(embed: embed.Build()));
        }