示例#1
0
        private Embed GetShopEmbed()
        {
            var shop  = ItemDatabase.GetShop();
            var embed = new EmbedBuilder();

            embed.WithColor(new Color(66, 45, 45));
            embed.WithThumbnailUrl(ItemDatabase.Shopkeeper);

            //if (DateTime.Now.Date >= new DateTime(day: 1, month: 3, year: 2021) &&
            //    DateTime.Now.Date < new DateTime(day: 15, month: 3, year: 2021))
            //{
            //    embed.WithDescription("It's the Tolbi market! Up until March 14th you'll get a chance to find more and rarer gear! With this many, the stalls are rotated every 6 hours!");
            //}

            embed.AddField("Shop:", shop.InventoryToString(Detail.NameAndPrice), true);

            var fb = new EmbedFooterBuilder();

            fb.WithText($"{ItemDatabase.RestockMessage} {ItemDatabase.TimeToNextReset:hh\\h\\ mm\\m}");
            embed.WithFooter(fb);
            return(embed.Build());
        }
示例#2
0
 private Embed GetAnimeResultEmbed(AnimeResult result, int index, EmbedFooterBuilder footer) => new EmbedBuilder()
 .WithColor(0x2E51A2)
 .WithAuthor(author => {
     author
     .WithName($"{result.Title}")
     .WithUrl($"{result.SiteUrl}")
     .WithIconUrl(result.ApiType.ToIconUrl());
 })
 .WithDescription($"" +
                  $"__**Description:**__\n" +
                  $"{result.Synopsis.ShortenText()}")
 .AddField("Details ▼",
           $"► Type: **{result.Type}** [Source: **{result.Source}**] \n" +
           $"► Status: **{result.Status}**\n" +
           $"► Episodes: **{"Unknown".IfTargetIsNullOrEmpty(result.Episodes?.ToString())} [{result.Duration} Min]** \n" +
           $"► Score: **{"NaN".IfTargetIsNullOrEmpty($"{result.Score?.ToString()}")}**☆\n" +
           $"► Studio: **[{"Unknown".IfTargetIsNullOrEmpty(result.Studio?.ToString())}]({result.StudioUrl})**\n" +
           $"Broadcast Time: **[{"Unknown".IfTargetIsNullOrEmpty(result.Broadcast?.ToString())}]**\n" +
           $"**{(result.TrailerUrl != null ? $"[Trailer]({result.TrailerUrl})" : "No trailer")}**\n")
 .WithFooter(footer)
 .WithImageUrl(result.ImageUrl)
 .Build();
        public async static Task DisplayQuote(Quote q, IGuildUser[] users, ICommandContext context)
        {
            EmbedBuilder ebm = new EmbedBuilder()
            {
                Color = Color.Blue
            };

            IGuildUser quotee = users[0];

            ebm.WithTitle($"Quote #{q.Id} by {(quotee == null ? q.Qoutee.Username : (quotee.Nickname??quotee.Username))}");

            if (quotee != null)
            {
                ebm.WithThumbnailUrl(quotee.GetAvatarUrl());
            }
            if (ebm.ThumbnailUrl == null)
            {
                ebm.WithThumbnailUrl("https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png");
            }

            ebm.AddField("Quote", $"```\r\n{q.QuoteText.RemoveAbuseCharacters()}\r\n```");

            EmbedFooterBuilder efb     = new EmbedFooterBuilder();
            IGuildUser         creator = users[1];

            if (creator != null)
            {
                efb.WithIconUrl(creator.GetAvatarUrl());
            }
            if (efb.IconUrl == null)
            {
                efb.WithIconUrl("https://discordapp.com/assets/dd4dbc0016779df1378e7812eabaa04d.png");
            }

            efb.WithText($"Quoted by {(creator == null ? q.Creator.Username : (creator.Nickname??creator.Username))} on {q.Time.ToShortDateString()}");
            ebm.WithFooter(efb);

            await context.Channel.SendMessageAsync(embed : ebm.Build());
        }
示例#4
0
        public async Task ExecuteAsync(SocketUserMessage msg, string[] parameters)
        {
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
            Task.Run(async() =>
            {
                EmbedBuilder eb       = new EmbedBuilder();
                EmbedFooterBuilder ef = new EmbedFooterBuilder();

                ef.Text = "Command_Help";
                eb.WithFooter(footer: ef);
                eb.WithCurrentTimestamp();
                eb.Color = Color.Blue;

                foreach (var Command in CommandHandler.Commands)
                {
                    eb.AddField($"Command: ;;{Command.Name}", $"Summary: {Command.Help}");
                }

                await msg.Author.SendMessageAsync("", embed: eb);
            });
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
        }
示例#5
0
        public async void Refresh(SocketGuild g, string title, string description, string footerText)
        {
            EmbedFooterBuilder f = new EmbedFooterBuilder();

            f.WithText(footerText);

            Panel.WithTitle(title);
            Panel.WithDescription(description);
            Panel.WithFooter(f);

            if (!Message.Exists())
            {
                if (g.TryGetTextChannel(ChannelId, out SocketTextChannel c))
                {
                    Message = c.SendMessageAsync(embed: Panel.Build()).Result;
                }
            }
            else
            {
                await Message.ModifyAsync(x => { x.Embed = Panel.Build(); });
            }
        }
示例#6
0
        public static Embed GetEmbedAdmin()
        {
            var footer = new EmbedFooterBuilder()
            {
                Text = "Contribute to the Server | https://github.com/encodeous/gardener/tree/master"
            };

            return(new EmbedBuilder()
            {
                Color = Color.Blue,
                Title = "**The Friend Admin Tree | Help**",
                Description =
                    $"**Commands**\n" +
                    $"  !help admin - Show help information\n" +
                    $"  !mirror <message-id> - Mirrors the message with the bot\n" +
                    $"  !register <user-id> - Forces a user to be registered if not already\n" +
                    $"  !channel <name> - Creates a private channel\n" +
                    $"  !delchannel <tag-channel> - Deletes a private channel\n" +
                    $"  !filter - Toggle filtering on the current channel",
                Footer = footer
            }.Build());
        }
示例#7
0
        public static async Task ModLog(SocketCommandContext context, string action, Color color, string reason, IUser subject = null, string extra = "")
        {
            using (var db = new DbContext())
            {
                var guildRepo = new GuildRepository(db);
                var guild     = await guildRepo.FetchGuildAsync(context.Guild.Id);

                EmbedFooterBuilder footer = new EmbedFooterBuilder()
                {
                    IconUrl = "http://i.imgur.com/BQZJAqT.png",
                    Text    = $"Case #{guild.CaseNumber}"
                };
                EmbedAuthorBuilder author = new EmbedAuthorBuilder()
                {
                    IconUrl = context.User.GetAvatarUrl(),
                    Name    = $"{context.User.Username}#{context.User.Discriminator}"
                };

                string userText = null;
                if (subject != null)
                {
                    userText = $"\n** User:** { subject} ({ subject.Id})";
                }
                var builder = new EmbedBuilder()
                {
                    Author      = author,
                    Color       = color,
                    Description = $"**Action:** {action}{extra}{userText}\n**Reason:** {reason}",
                    Footer      = footer
                }.WithCurrentTimestamp();

                if (context.Guild.GetTextChannel(guild.ModLogChannelId) != null)
                {
                    await context.Guild.GetTextChannel(guild.ModLogChannelId).SendMessageAsync("", embed: builder);

                    await guildRepo.ModifyAsync(x => { x.CaseNumber++; return(Task.CompletedTask); }, context.Guild.Id);
                }
            }
        }
示例#8
0
 public UserCommands(TimerService timer,
                     Logger.Logger logger,
                     IPrefixService prefixService,
                     GuildService guildService,
                     LastFMService lastFmService,
                     IIndexService indexService,
                     UserService userService,
                     FriendsService friendsService)
 {
     this._timer          = timer;
     this._logger         = logger;
     this._prefixService  = prefixService;
     this._guildService   = guildService;
     this._friendsService = friendsService;
     this._userService    = userService;
     this._lastFmService  = lastFmService;
     this._indexService   = indexService;
     this._embed          = new EmbedBuilder()
                            .WithColor(DiscordConstants.LastFMColorRed);
     this._embedAuthor = new EmbedAuthorBuilder();
     this._embedFooter = new EmbedFooterBuilder();
 }
示例#9
0
        private Embed CreateChangeEmbed(List <string> changedStats)
        {
            EmbedBuilder e = new EmbedBuilder();

            e.Color       = new Color(136, 107, 62);
            e.Title       = $"Level up!";
            e.Description = string.Join("\n", changedStats);
            e.WithCurrentTimestamp();

            EmbedAuthorBuilder author = new EmbedAuthorBuilder();

            author.Name = Name;
            e.Author    = author;

            EmbedFooterBuilder footer = new EmbedFooterBuilder();

            footer.IconUrl = "https://imgb.apk.tools/150/b/c/2/com.jagex.oldscape.android.png";
            footer.Text    = "Old School RuneScape";
            e.Footer       = footer;

            return(e.Build());
        }
示例#10
0
        public async Task FeedbackCommand([Remainder] string feedback)
        {
            var channel = Context.Client.GetChannel(296117398132752384) as SocketTextChannel;
            var sender  = Context.User;
            var guild   = Context.Guild;

            var author = new EmbedAuthorBuilder()
                         .WithName(sender.Username)
                         .WithIconUrl(new Uri(sender.GetAvatarUrl()));

            var footer = new EmbedFooterBuilder()
                         .WithText($"{guild.Name} | {guild.Id}")
                         .WithIconUrl(new Uri(guild.IconUrl));

            var body = new EmbedBuilder()
                       .WithColor(Rand.GetRandomColor())
                       .WithAuthor(author)
                       .WithFooter(footer)
                       .WithDescription(feedback);

            await channel.SendMessageAsync("", embed : body);
        }
示例#11
0
        public void Send(string user, string type, string item, string attribute, string value)
        {
            if (!PvPModifier.Config.EnableDiscordWebhook)
            {
                return;
            }

            var ea = new EmbedAuthorBuilder {
                Name = type
            };

            var ef = new EmbedFooterBuilder {
                Text = user
            };

            var eb = new EmbedBuilder {
                Author = ea,
                Footer = ef
            };

            if (attribute.Equals(DbConsts.Shoot) || attribute.Equals(DbConsts.UseAmmoIdentifier))
            {
                value = MiscUtils.GetNameIDProjectile(int.Parse(value));
            }
            else if (attribute.Equals(DbConsts.InflictBuffID) || attribute.Equals(DbConsts.ReceiveBuffID))
            {
                value = MiscUtils.GetNameIDBuff(int.Parse(value));
            }
            else if (attribute.Equals(DbConsts.NotAmmo))
            {
                value = attribute.Equals("0") ? "True" : "False";
            }

            eb.AddField(item, $"Changed {attribute} to {value}");

            Embed[] embedArray = new Embed[] { eb.Build() };

            _client.SendMessageAsync(embeds: embedArray);
        }
示例#12
0
        public async Task DeleteVC([Remainder] string name)
        {
            var allChannels = await Context.Guild.GetVoiceChannelsAsync();

            var nochannel = allChannels.Where(x => x.Name == name);

            if (nochannel.Count() == 0)
            {
                string msg   = "There are no voice channels with that name";
                var    embed = new EmbedBuilder()
                               .WithColor(new Color(color))
                               .WithDescription(msg);
                await Context.Channel.SendMessageAsync("", embed : embed);
            }
            else
            {
                allChannels.Where(x => x.Name == name).ToList().ForEach(async(x) =>
                {
                    await x.DeleteAsync();
                });
                string msg   = $"Voice channels **{name}** deleted!";
                var    embed = new EmbedBuilder()
                               .WithColor(new Color(color))
                               .WithDescription(msg);
                var m = await Context.Channel.SendMessageAsync("", embed : embed);

                var author = Context.Message.Author;
                var log    = await Context.Guild.GetChannelAsync(logchannel) as IMessageChannel;

                var footer = new EmbedFooterBuilder()
                             .WithText(m.CreatedAt.ToString());
                var embed4 = new EmbedBuilder()
                             .WithColor(new Color(red))
                             .AddField("Channels deleted", $"{author.Mention} Deleted channels with name: **{name}**")
                             .WithThumbnailUrl(author.GetAvatarUrl())
                             .WithFooter(footer);
                await log.SendMessageAsync("", embed : embed4);
            }
        }
示例#13
0
        public async Task TanookiFactAsync()
        {
            Random _rand = new Random();

            //Get a fact from the file
            string tanookiFact = "Did you know Tanooki has a big bushy tail?";

            if (File.Exists(_dataServices.TanookiFactPath))
            {
                var allLines   = File.ReadAllLines(_dataServices.TanookiFactPath);
                var lineNumber = _rand.Next(0, allLines.Length);
                tanookiFact = allLines[lineNumber];
            }

            //Build and send
            var authBuilder = new EmbedAuthorBuilder()
            {
                Name    = $"TANOOKI FACTS!",
                IconUrl = Context.Message.Author.GetAvatarUrl(),
            };

            var footBuilder = new EmbedFooterBuilder()
            {
                Text = "This was Tanooki facts, you cannot unsubscribe."
            };
            var builder = new EmbedBuilder()
            {
                Author = authBuilder,
                Footer = footBuilder,

                ThumbnailUrl = this._dataServices.GetRandomImgFromUrl("https://content.tophattwaffle.com/BotHATTwaffle/tanookifacts/"),
                Color        = new Color(230, 235, 240),

                Description = tanookiFact
            };
            await _dataServices.ChannelLog($"{Context.Message.Author.Username.ToUpper()} JUST GOT HIT WITH A TANOOKI FACT");

            await ReplyAsync("", false, builder.Build());
        }
示例#14
0
        public async Task BalanceAsync()
        {
            var    userInfo = (IGuildUser)Context.User;
            string userName = null;

            if (userInfo.Nickname != null)
            {
                userName = userInfo.Nickname;
            }
            else
            {
                userName = Context.User.Username;
            }

            var SQL      = new SQLFunctions.Main();
            var userData = SQL.LoadUserData(Context.User);

            var footer = new EmbedFooterBuilder
            {
                Text = "Cody by Ayla / Alsekwolf#0001"
            };
            var author = new EmbedAuthorBuilder
            {
                IconUrl = Context.User.GetAvatarUrl(),
                Name    = $"{userName}'s wallet"
            };
            var embed = new EmbedBuilder
            {
                Author      = author,
                Color       = Color.Magenta,
                Footer      = footer,
                Description = $"**{userName}** you currently have **${userData.cash}**",
                Timestamp   = DateTimeOffset.Now
            };

            var embedBuilt = embed.Build();
            await Context.Channel.SendMessageAsync(embed : embedBuilt);
        }
示例#15
0
        public async Task StatsCommand()
        {
            if (Stats.IsReady)
            {
                using (Context.Channel.EnterTypingState())
                {
                    var appinfo = await Context.Client.GetApplicationInfoAsync();

                    var author = new EmbedAuthorBuilder()
                                 .WithIconUrl(new Uri(appinfo.IconUrl))
                                 .WithName(Context.Client.CurrentUser.Username);

                    var footer = new EmbedFooterBuilder()
                                 .WithText("Created by " + appinfo.Owner.Username);

                    var body = new EmbedBuilder()
                               .WithAuthor(author)
                               .WithFooter(footer)
                               .WithColor(Rand.GetRandomColor())
                               .WithTitle("Bot Statistics")
                               .WithDescription($"{Stats.UniqueUserCount} unique users\n" +
                                                $"{Stats.GuildCount} guilds\n" +
                                                $"{Stats.TextChannels} text channels\n" +
                                                $"{Stats.VoiceChannels} voice channels\n" +
                                                $"{Stats.RolesCount} roles");

                    body.AddInlineField("Largest Guild", $"{Stats.LargestGuild}\n{Stats.LargestGuildCount} users");
                    body.AddInlineField("Most Roles Guild", $"{Stats.MostRolesGuild}\n{Stats.MostRolesCount} roles");
                    body.AddInlineField($"Most Channels Guild", $"{Stats.MostChannelsGuild}\n{Stats.MostChannelsCount} channels");

                    await ReplyAsync("", embed : body);
                }
            }
            else
            {
                await ReplyAsync("Bot statistics has not been calculated yet.");
            }
        }
示例#16
0
        public async Task Status([Remainder] SocketUser user = null)
        {
            user ??= Context.User;
            var account = EntityConverter.ConvertUser(user);
            var factory = new PlayerFighterFactory();
            var p       = factory.CreatePlayerFighter(account);

            var author = new EmbedAuthorBuilder();

            author.WithName($"{(user is SocketGuildUser sguser ? sguser.DisplayName() : user.Username)}");
            author.WithIconUrl(user.GetAvatarUrl());

            var embed = new EmbedBuilder()
                        .WithColor(Colors.Get(account.Element.ToString()))
                        .WithAuthor(author)
                        .WithTitle($"Level {account.LevelNumber} {account.GsClass} {string.Join("", account.TrophyCase.Trophies.Select(t => t.Icon))} (Rank {UserAccounts.GetRank(account) + 1})")
                        .AddField("Current Equip", account.Inv.GearToString(AdeptClassSeriesManager.GetClassSeries(account).Archtype), true)
                        .AddField("Psynergy", p.GetMoves(false), true)
                        .AddField("Djinn", account.DjinnPocket.GetDjinns().GetDisplay(DjinnDetail.None), true)

                        .AddField("Stats", p.Stats.ToString(), true)
                        .AddField("Elemental Stats", p.ElStats.ToString(), true)

                        .AddField("Unlocked Classes", account.BonusClasses.Count == 0 ? "none" : string.Join(", ", account.BonusClasses))

                        .AddField("XP", $"{account.Xp} - next in {account.XPneeded}{(account.NewGames >= 1 ? $"\n({account.TotalXp} total | {account.NewGames} resets)" : "")}", true)
                        .AddField("Colosso wins | Dungeon Wins", $"{account.ServerStats.ColossoWins} | {account.ServerStats.DungeonsCompleted}", true)
                        .AddField("Endless Streaks", $"Solo: {account.ServerStats.EndlessStreak.Solo} | Duo: {account.ServerStats.EndlessStreak.Duo} \nTrio: {account.ServerStats.EndlessStreak.Trio} | Quad: {account.ServerStats.EndlessStreak.Quad}", true);

            if (user is SocketGuildUser socketGuildUser)
            {
                var footer = new EmbedFooterBuilder();
                footer.WithText("Joined this Server on " + socketGuildUser.JoinedAt.Value.Date.ToString("dd-MM-yyyy"));
                footer.WithIconUrl(Sprites.GetImageFromName("Iodem"));
                embed.WithFooter(footer);
            }
            await Context.Channel.SendMessageAsync("", false, embed.Build());
        }
示例#17
0
        public static Embed GetEmbed()
        {
            var footer = new EmbedFooterBuilder()
            {
                Text = "Contribute to the Server | https://github.com/encodeous/gardener/tree/master"
            };

            return(new EmbedBuilder()
            {
                Color = Color.Blue,
                Title = "**The Friend Tree | Help**",
                Description =
                    $"**Commands**\n" +
                    $"  !help - Show help information\n" +
                    $"  !info - Display information about the bot\n" +
                    $"  !invite - Invite your friends and expand the tree!\n" +
                    $"  !whois <tag-person> - Show information about a person\n" +
                    $"  !friends - Show your Friends\n" +
                    $"  !friend <tag-person> - Add a person as friend\n" +
                    $"  !unfriend <tag-person> - Remove a friend\n" +
                    $"  !trace <tag-person> - Traces a route of friends between you and another person\n" +
                    $"\n" +
                    $"**Private Channels (Not Yet Available)**\n" +
                    $"  !join <channel-code> - Joins channel with invite code\n" +
                    $"  !code - Gets the channel invite code for the current channel\n" +
                    $"  !leave - Leaves the current channel\n" +
                    $"\n" +
                    $"**Music Player (Musii)**\n" +
                    $"  !play [p, pl, listen, yt, youtube] <youtube-link> - Plays the youtube link in your current voice channel\n" +
                    $"  !s [skip] - Skips the active song\n" +
                    $"  !c [leave, empty, clear] - Clears the playback queue\n" +
                    $"  !q [queue] - Shows the songs in the queue\n" +
                    $"  !musii - Invite Musii to your server!\n" +
                    $"\n" +
                    $"**If you have any other questions, don't hesitate, just ask!**\n",
                Footer = footer
            }.Build());
        }
示例#18
0
        public static Embed GetEmbed(UserObject obj)
        {
            var footer = new EmbedFooterBuilder()
            {
                Text = "Contribute to the Server | https://github.com/encodeous/gardener/tree/master"
            };
            StringBuilder sb = new StringBuilder();

            sb.Append("**Friends:**\n");

            foreach (var id in obj.Friends)
            {
                sb.Append(DsUtils.GetDiscordUsername(Garden.TreeState.Users[id].UserId) + "\n");
            }

            sb.Append("\n**Invited Friends:**\n");

            foreach (var id in obj.FriendsInvited)
            {
                var uid = Garden.TreeState.Users[id].UserId;
                sb.Append(DsUtils.GetDiscordUsername(uid) + "\n");
            }

            sb.Append("\n**Invited By:**\n");

            var invitedByTreeId = obj.InvitedBy;
            var invitedByUserId = Garden.TreeState.Users[invitedByTreeId].UserId;

            sb.Append(DsUtils.GetDiscordUsername(invitedByUserId) + "\n");

            return(new EmbedBuilder()
            {
                Color = Color.Green,
                Title = "**Your Friends**",
                Description = sb.ToString(),
                Footer = footer
            }.Build());
        }
示例#19
0
            public async Task LatestAsync()
            {
                var user = Context.User as SocketGuildUser;

                if (!user.Roles.Any(role => role.Name.Equals("Mushroom")))
                {
                    return;
                }

                var logs = await _dataService.GetLatestLogs();

                EmbedBuilder embed = new()
                {
                    Title     = "Today's Logs",
                    Timestamp = DateTime.UtcNow,
                    Footer    = new EmbedFooterBuilder
                    {
                        Text = $"Showing top {((logs.Count() <= 10) ? logs.Count() : 10)} logs."
                    }
                };

                List <EmbedFieldBuilder> embeds = new List <EmbedFieldBuilder>();

                for (int i = 0; i < logs.Count(); i++)
                {
                    embeds.Add(new EmbedFieldBuilder()
                    {
                        Name     = logs.ElementAt(i).CreatedDateTime.ToString(),
                        Value    = $"{logs.ElementAt(i).Source}\n{logs.ElementAt(i).CreatedBy}\n{logs.ElementAt(i).Message}",
                        IsInline = false
                    });
                }

                embed.Fields = embeds;

                await ReplyAsync(embed : embed.Build());
            }
        }
示例#20
0
        public async Task GetReportsAsync(OldGlobal g, int page = 1)
        {
            EmbedBuilder e = EmbedData.DefaultEmbed;

            EmbedFooterBuilder f = new EmbedFooterBuilder();

            f.WithText($"{EmojiIndex.Report} Reports");
            e.WithFooter(f);

            const int MAX_DESC = 1024;
            string    desc     = "";

            List <string> list         = new List <string>();
            List <string> descriptions = new List <string>();

            List <Report> reports  = g.Reports;
            List <Report> accepted = g.AcceptedReports;


            foreach (Report accept in accepted)
            {
                list.Add("**+** " + accept.ToString(Context.Account));
            }
            foreach (Report r in reports)
            {
                list.Add(r.ToString(Context.Account));
            }
            if (!list.Funct())
            {
                await ReplyAsync(embed : EmbedData.Throw(Context, "Empty collection.", "There are currently no reports.", false));

                return;
            }

            Embed q = EmbedData.GenerateEmbedList(list, page, e);

            await ReplyAsync(embed : q);
        }
示例#21
0
        private async Task WriteEnemies()
        {
            var e     = new EmbedBuilder();
            var tasks = new List <Task>();

            if (Battle.SizeTeamB > 0)
            {
                e.WithThumbnailUrl(Battle.GetTeam(ColossoBattle.Team.B).FirstOrDefault().imgUrl);
            }
            var msg = EnemyMsg;
            var i   = 1;

            foreach (ColossoFighter fighter in Battle.GetTeam(ColossoBattle.Team.B))
            {
                //e.AddField(numberEmotes[i], $"{fighter.name} {fighter.stats.HP}/{fighter.stats.maxHP}", true);
                e.AddField($"{numberEmotes[i]}{fighter.ConditionsToString()}", $"{fighter.name}", true);
                i++;
            }
            if (IsEndless)
            {
                EmbedFooterBuilder footerBuilder = new EmbedFooterBuilder();
                footerBuilder.WithText($"Battle {winsInARow + 1} - {Diff}");
                e.WithFooter(footerBuilder);
            }
            if (!msg.Embeds.FirstOrDefault().ToEmbedBuilder().AllFieldsEqual(e))
            {
                tasks.Add(msg.ModifyAsync(m => m.Embed = e.Build()));
            }

            var validReactions = reactions.Where(r => r.MessageId == EnemyMsg.Id).ToList();

            foreach (var r in validReactions)
            {
                tasks.Add(EnemyMsg.RemoveReactionAsync(r.Emote, r.User.Value));
                reactions.Remove(r);
            }
            await Task.WhenAll(tasks);
        }
示例#22
0
        public async Task Module([Remainder] string name)
        {
            ModuleInfo module = services.GetModules().First(n => (n.Name.ToLower() == name.ToLower()));

            if (module != null)
            {
                EmbedBuilder       embed  = new EmbedBuilder();
                EmbedFooterBuilder footer = new EmbedFooterBuilder();

                //Make the footer the current UTC time
                footer.WithText(DateTime.UtcNow.ToString() + " UTC");
                embed.WithFooter(footer);
                embed.WithColor(new Color(0x4900ff));

                //Make the title the modules name + some info.
                embed.Title = $"Module {module.Name}'s commands. Contains {module.Commands.Count} out of 25 max commands.";

                //Add each command in the module into its own field.
                foreach (var cmd in module.Commands)
                {
                    embed.AddField(y =>
                    {
                        y.Name     = cmd.Name;
                        y.Value    = cmd.Summary;
                        y.IsInline = false;
                    });
                }

                await ReplyAsync("", embed : embed);
            }
            else
            {
                //The module was an invalid name, tell the user
                IUserMessage msg = await ReplyAsync("A module with the name '" + name + "' does not exist.");

                msg.DeleteAfterSeconds(20);
            }
        }
示例#23
0
    public async Task SendVoteLink()
    {
        Stopwatch sw = new Stopwatch();

        sw.Start();



        EmbedBuilder       eb = new EmbedBuilder();
        EmbedFooterBuilder fb = new EmbedFooterBuilder();


        fb.WithIconUrl(Context.Message.Author.GetAvatarUrl());

        eb.WithTitle($"Vote");
        eb.WithDescription("[Click here to vote for the bot!](https://top.gg/bot/732215647135727716/vote)");
        eb.WithThumbnailUrl("https://top.gg/images/logotrans.png");
        eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User));
        fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User, sw));;
        eb.WithFooter(fb);

        await ReplyAsync($"{Context.Message.Author.Mention}\n", false, eb.Build());
    }
        static Embed generateTest()
        {
            EmbedBuilder em = new Discord.EmbedBuilder();

            em.Color = Discord.Color.Blue;
            em.Title = "Title";
            EmbedAuthorBuilder eab = new EmbedAuthorBuilder();

            eab.Url        = "http://www.google.com/";
            eab.Name       = "Embed Author Name";
            eab.IconUrl    = "https://i.imgur.com/2HXCkSR.png";
            em.Author      = eab;
            em.Description = "Description";
            EmbedFooterBuilder emfb = new EmbedFooterBuilder();

            emfb.IconUrl    = "https://i.imgur.com/Pieqv0h.png";
            emfb.Text       = "Footer text";
            em.Footer       = emfb;
            em.ImageUrl     = "https://i.imgur.com/Wks5VLA.png";
            em.ThumbnailUrl = "https://i.imgur.com/asc2NGx.png";
            em.Timestamp    = new DateTimeOffset(new DateTime(2042, 4, 20, 4, 20, 42));
            return(em.Build());
        }
示例#25
0
        private async Task _client_UserLeft(SocketGuildUser user)
        {
            ulong      guildID = user.Guild.Id;
            LogMessage msg     = new LogMessage(LogSeverity.Info, "EventLogger", $"User {user.Id} Left Guild {guildID}!");

            Log(msg);

            var origField = new EmbedFieldBuilder()
                            .WithName("User Left")
                            .WithValue(user.Username);
            var footer = new EmbedFooterBuilder()
                         .WithIconUrl(_client.CurrentUser.GetAvatarUrl())
                         .WithText("ArbitiesLog");
            var embed = new EmbedBuilder()
                        .WithImageUrl(user.GetAvatarUrl(ImageFormat.Auto, 512))
                        .AddField(origField)
                        .WithFooter(footer)
                        .WithColor(Color.Red)
                        .Build();
            GuildData guildData = await GuildManager.GetGuildData(guildID);

            await((SocketTextChannel)_client.GetChannel(guildData.LogChannel)).SendMessageAsync(embed: embed);
        }
示例#26
0
    public async Task SendHSendBotInvite()
    {
        Stopwatch sw = new Stopwatch();

        sw.Start();



        EmbedBuilder       eb = new EmbedBuilder();
        EmbedFooterBuilder fb = new EmbedFooterBuilder();



        eb.WithTitle($"Invite");
        eb.WithDescription("[Click here to add the bot to your own server!](https://discord.com/oauth2/authorize?client_id=732215647135727716&scope=bot&permissions=268643345)");
        eb.WithThumbnailUrl("https://imgur.com/vwT3DuL.png");
        eb.WithColor(PremiumUtils.SelectEmbedColour(Context.User));;
        fb.WithIconUrl(Context.Message.Author.GetAvatarUrl());
        fb.WithText(PremiumUtils.SelectFooterEmbedText(Context.User, sw));;
        eb.WithFooter(fb);

        await ReplyAsync($"{Context.Message.Author.Mention}\n", false, eb.Build());
    }
示例#27
0
        public static EmbedBuilder BuildEmbed(string article, string lastEditor, string name)
        {
            return(new EmbedBuilder
            {
                Title = "Wiki",
                Color = Color.Gold,
                Description = @"Article: ""**" + name.ToLower() + @"**"". Was last edited by **" + lastEditor + "**",

                Footer = new EmbedFooterBuilder
                {
                    Text = Util.Globals.EmbedFooter
                },
                Timestamp = DateTime.UtcNow,
                Fields = new List <EmbedFieldBuilder>
                {
                    new()
                    {
                        Name = name.ToLower(),
                        Value = article,
                        IsInline = false
                    }
                }
            });
示例#28
0
        private static Embed createEmbed(SyndicationItem feedItem, SyndicationFeed parent)
        {
            EmbedBuilder e = new EmbedBuilder();

            e.Color = new Color(255, 255, 255);
            e.Title = feedItem.Title?.Text;
            e.Url   = feedItem.Links?.FirstOrDefault(x => !isImageUrl(x.Uri?.AbsoluteUri ?? ""))?.Uri?.AbsoluteUri ?? feedItem.BaseUri?.AbsoluteUri;

            try{
                e.Timestamp = feedItem.PublishDate.UtcDateTime.Year > 1 ? feedItem.PublishDate.UtcDateTime : feedItem.LastUpdatedTime.UtcDateTime;
            } catch (Exception ex) {
                e.Timestamp = DateTime.UtcNow;
            }

            EmbedFooterBuilder footer = new EmbedFooterBuilder();

            footer.IconUrl = "https://cdn5.vectorstock.com/i/1000x1000/82/39/the-news-icon-newspaper-symbol-flat-vector-5518239.jpg";
            footer.Text    = "RSS feed";
            e.Footer       = footer;

            EmbedAuthorBuilder author = new EmbedAuthorBuilder();

            author.Name = (feedItem.Authors?.FirstOrDefault()?.Name ?? feedItem.Authors?.FirstOrDefault()?.Email) ?? parent.Title?.Text;
            author.Url  = feedItem.Authors?.FirstOrDefault()?.Uri;
            e.Author    = author;

            e.ThumbnailUrl = parent.ImageUrl?.AbsoluteUri;

            e.Description = (new string(HtmlToPlainText(feedItem.Summary?.Text ?? "", out string htmlImage).Take(Math.Min(2000, feedItem.Summary?.Text?.Length ?? 0)).ToArray()));
            e.ImageUrl    = !string.IsNullOrEmpty(htmlImage) ? htmlImage : feedItem.Links?.FirstOrDefault(x => isImageUrl(x.Uri?.AbsoluteUri ?? ""))?.Uri?.AbsoluteUri;
            if (e.Description.Length >= 2000)
            {
                e.Description += " [...]";
            }

            return(e.Build());
        }
示例#29
0
        public async Task Info(Discord.IUser user)
        {
            Discord.IUser U             = user;
            Discord.IUser E             = Context.Message.Author;
            string        imgurl        = U.AvatarId;
            string        userurl       = U.Id.ToString();
            string        AvatartoEmbed = $"https://cdn.discordapp.com/avatars/{userurl}/{imgurl}.webp?size=1024";
            Random        rnd           = new Random();
            int           red           = rnd.Next(0, 255);
            int           green         = rnd.Next(0, 255);
            int           blue          = rnd.Next(0, 255);
            var           EmbedAuth     = new EmbedAuthorBuilder
            {
                Name = U.ToString(),
            };

            var EmbedFoot = new EmbedFooterBuilder
            {
                IconUrl = "https://cdn.discordapp.com/embed/avatars/0.png",
                Text    = $"Generated - {DateTime.UtcNow.ToLongDateString()}",
            };

            var EmbedBuilder = new EmbedBuilder
            {
                Title    = "Profile Picture",
                Author   = EmbedAuth,
                ImageUrl = AvatartoEmbed,
                Footer   = EmbedFoot,
                Url      = AvatartoEmbed,
                Color    = new Discord.Color(red, green, blue),
            }.Build();

            await Discord.UserExtensions.SendMessageAsync(E, embed : EmbedBuilder);


            await Context.Message.DeleteAsync();
        }
示例#30
0
        public static async Task P2IS_PS1_Set_List(SocialLinkerCommand sl_command)
        {
            // Create two variables for the command user and the command channel, derived from the message object taken in.
            SocketUser        user    = sl_command.User;
            SocketTextChannel channel = (SocketTextChannel)sl_command.Channel;

            // Get the account information of the command's user.
            var account = UserInfoClasses.GetAccount(user);

            var embed  = new EmbedBuilder();
            var author = new EmbedAuthorBuilder
            {
                Name    = "Persona 2: Innocent Sin (PlayStation®️) Conversation Portrait Sets",
                IconUrl = user.GetAvatarUrl()
            };

            embed.WithAuthor(author);

            // Set the color and thumbnail for the embeded message.
            embed.WithColor(EmbedSettings.Get_Game_Color("P2IS-PS1", null));
            embed.WithThumbnailUrl(EmbedSettings.Get_Game_Logo("P2IS-PS1"));

            // Create a description with the list of sprite sets available for the title.
            embed.WithDescription($"{OfficialSetMethods.Generate_Normal_Set_List("P2IS-PS1")}");

            // Create a footer based on the game version the list is from.
            var footer = new EmbedFooterBuilder
            {
                Text = "Version: P2IS-PS1"
            };

            // Add the footer to the embed.
            embed.WithFooter(footer);

            // Send the embeded message to the channel.
            await channel.SendMessageAsync("", false, embed.Build());
        }