Esempio n. 1
0
        private void addStyle(HtmlDocument document)
        {
            Embeds.WriteTestEditorCSS();
            document.ReferenceStyle("testEditor.css");

            //document.AddStyle(Embeds.TestEditorCSS());
        }
Esempio n. 2
0
        private async Task ReactionAdded(Cacheable <IUserMessage, ulong> arg1, ISocketMessageChannel arg2, SocketReaction arg3)
        {
            var amount  = 1;
            var msgId   = arg3.MessageId;
            var channel = (ITextChannel)arg2;

            //TODO: Don't duplicate previously pinned messages, use reaction count
            if (arg1.Id == 640802444233670676)
            {
                int originalAmount = 0;
                foreach (var pair in JackFrostBot.UserSettings.Currency.Get(channel.Guild.Id))
                {
                    if (pair.Item1 == arg3.UserId.ToString())
                    {
                        originalAmount = pair.Item2;
                    }
                }
                JackFrostBot.UserSettings.Currency.Add(channel.Guild.Id, arg3.UserId, amount);

                var botlog = await channel.Guild.GetTextChannelAsync(JackFrostBot.UserSettings.Channels.BotLogsId(channel.Guild.Id));

                var botchannel = await channel.Guild.GetTextChannelAsync(JackFrostBot.UserSettings.Channels.BotChannelId(channel.Guild.Id));

                Embed embed = Embeds.Earn(arg3.User.ToString(), amount, channel.Guild.Id);
                await botlog.SendMessageAsync("", embed : embed).ConfigureAwait(false);

                await botchannel.SendMessageAsync("", embed : embed).ConfigureAwait(false);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// The GetWarnings method returns an array of embeds detailing the user's warnings, time of warning, and moderator (if enabled).
        /// </summary>
        /// <param name="User">The user whose warnings you wish to receive.</param>
        /// <param name="RunBy">The user who has run the given warnings command.</param>
        /// <param name="Mention">The stringified mention for the target user.</param>
        /// <param name="Username">The target user's username in the given context.</param>
        /// <param name="ShowIssuer">Whether or not the moderators should be shown in the log. Enabled for moderators, disabled for DMed records.</param>
        /// <returns>An array of embeds containing the given user's warnings.</returns>

        public EmbedBuilder[] GetWarnings(ulong User, ulong RunBy, string Mention, string Username, bool ShowIssuer)
        {
            Infraction[] Infractions = InfractionsDB.GetInfractions(User);

            if (Infractions.Length <= 0)
            {
                return new EmbedBuilder[1] {
                           BuildEmbed(EmojiEnum.Love)
                           .WithTitle("No issued infractions!")
                           .WithDescription($"{Mention} has a clean slate!\n" +
                                            $"Go give {(User == RunBy ? "yourself" : "them")} a pat on the back. <3")
                }
            }
            ;

            List <EmbedBuilder> Embeds = new ();

            DexterProfile DexterProfile = InfractionsDB.GetOrCreateProfile(User);

            EmbedBuilder CurrentBuilder = BuildEmbed(EmojiEnum.Love)
                                          .WithTitle($"{Username}'s Infractions - {Infractions.Length} {(Infractions.Length == 1 ? "Entry" : "Entries")} and {DexterProfile.InfractionAmount} {(DexterProfile.InfractionAmount == 1 ? "Point" : "Points")}.")
                                          .WithDescription($"All times are displayed in {TimeZoneInfo.Local.DisplayName}");

            for (int Index = 0; Index < Infractions.Length; Index++)
            {
                Infraction Infraction = Infractions[Index];

                IUser Issuer = Client.GetUser(Infraction.Issuer);

                long TimeOfIssue = Infraction.TimeOfIssue;

                DateTimeOffset Time = DateTimeOffset.FromUnixTimeSeconds(TimeOfIssue > 253402300799 ? TimeOfIssue / 1000 : TimeOfIssue);

                EmbedFieldBuilder Field = new EmbedFieldBuilder()
                                          .WithName($"{(Infraction.InfractionTime == 0 ? "Warning" : $"{TimeSpan.FromSeconds(Infraction.InfractionTime).Humanize().Titleize()} Mute")} {Index + 1} (ID {Infraction.InfractionID}), {(Infraction.PointCost > 0 ? "-" : "")}{Infraction.PointCost} {(Infraction.PointCost == 1 ? "Point" : "Points")}.")
                                          .WithValue($"{(ShowIssuer ? $":cop: {(Issuer != null ? Issuer.GetUserInformation() : $"Unknown ({Infraction.Issuer})")}\n" : "")}" +
                                                     $":calendar: {Time:M/d/yyyy h:mm:ss}\n" +
                                                     $":notepad_spiral: {Infraction.Reason}"
                                                     );

                if (Index % 5 == 0 && Index != 0)
                {
                    Embeds.Add(CurrentBuilder);
                    CurrentBuilder = new EmbedBuilder().AddField(Field).WithColor(Color.Green);
                }
                else
                {
                    try {
                        CurrentBuilder.AddField(Field);
                    } catch (Exception) {
                        Embeds.Add(CurrentBuilder);
                        CurrentBuilder = new EmbedBuilder().AddField(Field).WithColor(Color.Green);
                    }
                }
            }

            Embeds.Add(CurrentBuilder);

            return(Embeds.ToArray());
        }
        internal async Task RecheckSignup(ulong discordId, ISocketMessageChannel channel)
        {
            IList <object> signup = null;
            int            i      = 0;

            for (i = 0; i < _latestValues.Count; i++)
            {
                if (_latestValues[i][(int)ColumnIDs.Discord].ToString() == discordId.ToString())
                {
                    signup = _latestValues[i];
                    break;
                }
            }

            if (signup is null)
            {
                return;
            }

            if (signup[24].ToString() != "Investigate App" && signup[24].ToString() != "Requirements not reached")
            {
                return;
            }

            var message = await channel.SendMessageAsync("Loading..");

            await CalculateDSN(signup, service, i);

            await message.ModifyAsync(x =>
            {
                x.Embed   = Embeds.SignupRecalculated(discordId);
                x.Content = "";
            });
        }
Esempio n. 5
0
 public void DeleteEmbed(ulong messageID)
 {
     if (Embeds.ContainsKey(messageID))
     {
         Embeds.Remove(messageID);
     }
 }
Esempio n. 6
0
        public async Task Mute(
            [Summary("The user to be muted.")]
            IUser user,
            [Summary("The length of the mute in minutes.\n(Default: 10)")]
            double period = 10,
            [Summary("The mute period span.\n(Default: Minutes)\n(Available: Seconds, Minutes, Hours, Days)")]
            Measure measure = Measure.Minutes,
            [Remainder]
            [Summary("The reason for the mute.\n(Default: \"No Reason Provided.\")")]
            string reason = "No Reason Provided.")
        {
            try
            {
                await _moderation.Mute(Context.Guild, user, Context.User, period, reason);

                await _moderation.StartTimer(Context.Guild, user, period, measure);

                var builders = await _log.CreateLog(user, Context.User, reason, Infraction.Mute);

                var channel = Context.Guild.GetChannel(Config.Log) as IMessageChannel;

                await channel.SendMessageAsync(embed : Embeds.CreateEmbed("Log", builders));

                await Context.Message.AddReactionAsync(new Emoji("✅"));
            }
            catch (Exception e)
            {
                await ReplyAsync(e.Message);
            }
        }
Esempio n. 7
0
        public void smoke_test_javascript_file()
        {
            var file = Embeds.GetFiles().First(x => x.FileName == "testEditor.js");

            file.Contents().ShouldNotBeEmpty();
            file.Folder.ShouldEqual("Controls");
        }
Esempio n. 8
0
        private bool CheckAndParseReaction(SocketReaction reaction, out Emoji emoji, out PaginatedEmbed embed)
        {
            emoji = null;
            embed = null;

            // Message check
            if (!reaction.Message.IsSpecified || reaction.Message.Value.Author.IsUser() || reaction.Message.Value.Author.Id != DiscordClient.CurrentUser.Id)
            {
                return(false);
            }

            // Reaction check
            if (reaction.Emote is not Emoji _emoji)
            {
                return(false);
            }

            // Embed check
            if (reaction.Message.Value.Embeds.Count == 0 || !Embeds.TryGetValue(reaction.MessageId, out embed) || embed.ResponseFor.Id != reaction.UserId)
            {
                return(false);
            }

            emoji = _emoji;
            return(true);
        }
Esempio n. 9
0
        public async Task Ban(
            [Summary("The user to be banned.")]
            SocketUser user,
            [Summary("The number of days of messages to be deleted.\n(Default: 1)")]
            int prune = 1,
            [Remainder]
            [Summary("The reason for the ban.\n(Default: \"No Reason Provided.\")")]
            string reason = "No Reason Provided.")
        {
            try
            {
                await _moderation.Ban(Context.Guild, user, Context.User, prune, reason);

                var builders = await _log.CreateLog(user, Context.User, reason, Infraction.Ban);

                var channel = Context.Guild.GetChannel(Config.Log) as IMessageChannel;

                await channel.SendMessageAsync(embed : Embeds.CreateEmbed("Log", builders));

                await Context.Message.AddReactionAsync(new Emoji("✅"));
            }
            catch (Exception e)
            {
                await ReplyAsync(e.Message);
            }
        }
Esempio n. 10
0
            /// <inheritdoc/>
            ITransformationMap <T> ITransformationMap <T> .Embed <TMember>(
                string relation,
                Expression <Func <T, TMember> > memberSelector,
                Func <T, ILinkData> linkSelector)
            {
                if (memberSelector is null)
                {
                    throw new ArgumentNullException(nameof(memberSelector));
                }
                if (relation is null)
                {
                    throw new ArgumentNullException(nameof(relation));
                }
                if (linkSelector is null)
                {
                    throw new ArgumentNullException(nameof(linkSelector));
                }

                switch (memberSelector.Body)
                {
                case MemberExpression me:
                    var valueSelector = memberSelector.Compile();
                    Links[relation] = new LinkInstruction <T>(linkSelector);
                    Embeds.Add(new MemberEmbedInstruction <T, TMember>(relation, me.Member.Name, valueSelector));
                    return(this);

                default:
                    throw new ArgumentException(MalformedValueSelector);
                }
            }
Esempio n. 11
0
            /// <inheritdoc/>
            ITransformationMap <T> ITransformationMap <T> .Embed <TMember>(
                string relation,
                Expression <Func <T, TMember> > memberSelector,
                Func <T, TMember, ILinkData> linkSelector)
            {
                if (memberSelector is null)
                {
                    throw new ArgumentNullException(nameof(memberSelector));
                }
                if (relation is null)
                {
                    throw new ArgumentNullException(nameof(relation));
                }
                if (linkSelector is null)
                {
                    throw new ArgumentNullException(nameof(linkSelector));
                }

                switch (memberSelector.Body)
                { // todo(cosborn) Allow indexing, in the case of collections and dictionaries?
                case MemberExpression me:
                    var valueSelector = memberSelector.Compile();
                    Links[relation] = new LinkInstruction <T>(t => linkSelector(t, valueSelector(t)));
                    Embeds.Add(new MemberEmbedInstruction <T, TMember>(relation, me.Member.Name, valueSelector));
                    return(this);

                default:
                    throw new ArgumentException(MalformedValueSelector);
                }
            }
        /// <summary>
        /// Adds embeds to the interaction response
        /// </summary>
        /// <param name="embeds">The embeds to add to this interaction response</param>
        /// <returns>The modified interaction builder</returns>
        public DiscordInteractionBuilder WithEmbeds(IEnumerable <DiscordEmbed> embeds)
        {
            var list = Embeds.ToList();

            list.AddRange(embeds);
            Embeds = list;
            return(this);
        }
        /// <summary>
        /// Adds an embed to the interaction response
        /// </summary>
        /// <param name="embed">The embed to add to the interaction response</param>
        /// <returns>The modified interaction builder</returns>
        public DiscordInteractionBuilder WithEmbed(DiscordEmbed embed)
        {
            var list = Embeds.ToList();

            list.Add(embed);
            Embeds = list;
            return(this);
        }
Esempio n. 14
0
 public CategoryEmbeds(
     bool embedGame      = false,
     bool embedVariables = false)
 {
     embeds         = new Embeds();
     EmbedGame      = embedGame;
     EmbedVariables = embedVariables;
 }
Esempio n. 15
0
 public CategoryEmbeds(
     bool embedGame = false, 
     bool embedVariables = false)
 {
     embeds = new Embeds();
     EmbedGame = embedGame;
     EmbedVariables = embedVariables;
 }
Esempio n. 16
0
 public LevelEmbeds(
     bool embedCategories = false,
     bool embedVariables = false)
 {
     embeds = new Embeds();
     EmbedCategories = embedCategories;
     EmbedVariables = embedVariables;
 }
Esempio n. 17
0
 public LevelEmbeds(
     bool embedCategories = false,
     bool embedVariables  = false)
 {
     embeds          = new Embeds();
     EmbedCategories = embedCategories;
     EmbedVariables  = embedVariables;
 }
Esempio n. 18
0
        public async Task HandleArchiveCommand(ITextChannel channel, [Remainder] string category)
        {
            if (string.IsNullOrEmpty(category))
            {
                return;
            }

            category = new CultureInfo("en-GB", false).TextInfo.ToTitleCase(category);
            string env = HARDCODED_ARCHIVE_PATH;

            Guild g = new Guild(new Snowflake(Context.Guild.Id), Context.Guild.Name, Context.Guild.IconUrl);
            var   discordCategory = channel.CategoryId.HasValue ? await channel.GetCategoryAsync() : null;

            ChannelCategory cc = new ChannelCategory(new Snowflake(channel.CategoryId.Value), discordCategory.Name, discordCategory.Position);
            Channel         c  = new Channel(new Snowflake(channel.Id), ChannelKind.GuildTextChat, g.Id, cc, channel.Name, channel.Position, channel.Topic);

            ExportRequest req = new ExportRequest(g, c, env + $"/{category}/Light/{channel.Name}.html", ExportFormat.HtmlLight,
                                                  null, null, PartitionLimit.Null, MessageFilter.Null, true, true, "yyyy-MM-dd hh:mm:ss");

            ExportRequest req2 = new ExportRequest(g, c, env + $"/{category}/Dark/{channel.Name}.html", ExportFormat.HtmlDark,
                                                   null, null, PartitionLimit.Null, MessageFilter.Null, true, true, "yyyy-MM-dd hh:mm:ss");

            bool   isLight = true;
            string path    = env + $"/{category}/{(isLight ? "Light" : "Dark")}/{channel.Name}.html_Files/";


            var message = await Context.Channel.SendMessageAsync("", false, Embeds.Archiving(Context.User, channel, "Starting")).ConfigureAwait(false);

            //Timer _timer = new Timer(async _ => await OnTick(), null, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10));


            try
            {
                await message.ModifyAsync(x => x.Embed = Embeds.Archiving(Context.User, channel, "Exporting Light Mode")).ConfigureAwait(false);

                await _exporter.ExportChannelAsync(req).ConfigureAwait(false);

                await message.ModifyAsync(x => x.Embed = Embeds.Archiving(Context.User, channel, "Exporting Dark Mode")).ConfigureAwait(false);

                isLight = false;
                await _exporter.ExportChannelAsync(req2).ConfigureAwait(false);

                await message.ModifyAsync(x => x.Embed = Embeds.Archiving(Context.User, channel, "Done"));
            }
            catch (Exception ex)
            {
                await message.ModifyAsync(x =>
                {
                    x.Content = $"Error occured: {ex}";
                    x.Embed   = null;
                });
            }

            //async Task OnTick()
            //{
            //    await message.ModifyAsync(x => x.Content = $"Exported: {Directory.GetFiles(path, "*.*").Length} files.");
            //}
        }
Esempio n. 19
0
            /// <inheritdoc/>
            ITransformationMap <TCollection, TElement> IElementTransformationMap <TCollection, TElement> .EmbedElements(
                string relation,
                Func <TElement, ILinkData?> selector)
            {
                Links[relation] = new ManyLinkInstruction <TCollection>(c => c.Select(selector));
                Embeds.Add(new ManyEmbedInstruction <TCollection, TElement>(relation, "[*]", _ => _));

                return(this);
            }
Esempio n. 20
0
        internal async Task HandleRenameRequestAsync(RenameRequest req, IEmote emote, IUser approver, IUserMessage message)
        {
            if (emote.Name != _acceptEmote.Name && emote.Name != _denyEmote.Name) return;
            if (IsStaffMember(approver as IGuildUser) == false)
            {
                var m = await message.Channel.SendMessageAsync($"{approver.Mention} you cannot approve/deny this name change.");
                _deleteService.ScheduleDeletion(m, 5);
                return;
            }
            bool accepted = emote.Name == _acceptEmote.Name;

            if (req != null)
            {
                if (!accepted)
                {
                    await message.ModifyAsync(x => x.Embed = Embeds.RequestRename(req.GuildUser, req.Type, req.NewName, accepted, approver.Mention));
                    _renameRequests.Remove(req);
                    return;
                }

                if (req.Type == "discord" || req.Type == "both")
                {
                    string newDiscordName = "";
                    if (req.GuildUser.Nickname != null)
                    {
                        int indexOfBracket = req.GuildUser.Nickname.IndexOf("]");
                        if (indexOfBracket == -1)
                            newDiscordName = req.NewName;
                        else
                            newDiscordName = req.GuildUser.Nickname.Substring(0, indexOfBracket + 1) + " " + req.NewName;
                    }
                    else
                        newDiscordName = req.NewName;

                    await req.GuildUser.ModifyAsync(x =>
                    {
                        x.Nickname = newDiscordName;
                    }).ConfigureAwait(false);
                }


                if (req.Type == "spreadsheet" || req.Type == "both")
                {
                    int row = _dsn.GetRowNumber(req.GuildUser.Id);

                    if (row != -1)
                    {
                        string sectionToEdit = $"Player Data!C{row}";
                        _dsn.MakeRequest(sectionToEdit, new List<object>() { req.NewName });
                        return;
                    }
                }

                await message.ModifyAsync(x => x.Embed = Embeds.RequestRename(req.GuildUser, req.Type, req.NewName, accepted, approver.Mention));
                _renameRequests.Remove(req);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Adds a new embed to the list of embed to send
        /// </summary>
        /// <param name="embed">Embed to add</param>
        /// <returns>This</returns>
        /// <exception cref="IndexOutOfRangeException">Thrown if more than 10 embeds are added in a send as that is the discord limit</exception>
        public WebhookEditMessage AddEmbed(DiscordEmbed embed)
        {
            if (Embeds.Count >= 10)
            {
                throw new IndexOutOfRangeException("Only 10 embed are allowed per message");
            }

            Embeds.Add(embed);
            return(this);
        }
Esempio n. 22
0
        public async Task StopRaid()
        {
            await _commands.RaidFinished().ConfigureAwait(false);

            RaidInfo ri = Globals._activeRaid;

            Globals._activeRaid = null;
            Globals.AlreadyRaided.Clear();
            IGuild g = Context.Guild;

            await Context.Channel.SendMessageAsync("", false, Embeds.RaidEnded(_db, ri, g)).ConfigureAwait(false);
        }
Esempio n. 23
0
 public async Task Modules()
 {
     try
     {
         var modules = _help.ListModules();
         await Context.Channel.SendMessageAsync(embed : Embeds.CreateEmbed("Modules", modules));
     }
     catch (Exception e)
     {
         await ReplyAsync(e.Message);
     }
 }
Esempio n. 24
0
 public async Task BotInfo()
 {
     try
     {
         var botInfo = _utility.ListBotInfo();
         await Context.Channel.SendMessageAsync(embed : Embeds.CreateEmbed("Bot Info", botInfo));
     }
     catch (Exception e)
     {
         await ReplyAsync(e.Message);
     }
 }
Esempio n. 25
0
        public Task ModifyAsync(Action <MessageProperties> func, RequestOptions options = null)
        {
            var props = new MessageProperties {
                Content = Content, Embed = Optional.Create(Embeds.FirstOrDefault() as Embed)
            };

            func(props);
            Content = props.Content.Value;
            Embeds  = props.Embed.IsSpecified ? new List <IEmbed> {
                props.Embed.Value
            } : new List <IEmbed>();
            return(Task.CompletedTask);
        }
Esempio n. 26
0
 public async Task Commands(
     [Summary("The name of the module to be searched for.")]
     string moduleName)
 {
     try
     {
         var module   = _help.GetModuleInfo(moduleName);
         var commands = _help.ListCommands(module);
         await Context.Channel.SendMessageAsync(embed : Embeds.CreateEmbed(module.Name, commands));
     }
     catch (Exception e)
     {
         await ReplyAsync(e.Message);
     }
 }
Esempio n. 27
0
        public async Task StartRaid()
        {
            RaidInfo newRaid = new RaidInfo();

            newRaid.DateOfRaid = DateTime.UtcNow;

            _db.Raids.Add(newRaid);
            await _db.SaveChangesAsync();

            Globals._activeRaid = newRaid;

            await _commands.CheckUsersInRaidChannel().ConfigureAwait(false);

            await Context.Channel.SendMessageAsync("", false, Embeds.RaidStarted(Globals._activeRaid, Context.User as IGuildUser)).ConfigureAwait(false);
        }
Esempio n. 28
0
 internal async Task SendHelpForCommand(string command, ICommandContext Context)
 {
     var result = _commands.Search(Context, command);
     if (result.IsSuccess)
     {
         foreach (var foundCommand in result.Commands)
         {
             await Context.Channel.SendMessageAsync("", false, Embeds.CommandHelp(foundCommand)).ConfigureAwait(false);
         }
     }
     else
     {
         await Context.Channel.SendMessageAsync("", false, Embeds.CommandNotFound(command)).ConfigureAwait(false);
     }
 }
Esempio n. 29
0
 public GameEmbeds(
     bool embedLevels = false,
     bool embedCategories = false,
     bool embedModerators = false,
     bool embedPlatforms = false,
     bool embedRegions = false,
     bool embedVariables = false)
 {
     embeds = new Embeds();
     EmbedLevels = embedLevels;
     EmbedCategories = embedCategories;
     EmbedModerators = embedModerators;
     EmbedPlatforms = embedPlatforms;
     EmbedRegions = embedRegions;
     EmbedVariables = embedVariables;
 }
Esempio n. 30
0
 public GameEmbeds(
     bool embedLevels     = false,
     bool embedCategories = false,
     bool embedModerators = false,
     bool embedPlatforms  = false,
     bool embedRegions    = false,
     bool embedVariables  = false)
 {
     embeds          = new Embeds();
     EmbedLevels     = embedLevels;
     EmbedCategories = embedCategories;
     EmbedModerators = embedModerators;
     EmbedPlatforms  = embedPlatforms;
     EmbedRegions    = embedRegions;
     EmbedVariables  = embedVariables;
 }
Esempio n. 31
0
 public RunEmbeds(
     bool embedGame     = false,
     bool embedCategory = false,
     bool embedLevel    = false,
     bool embedPlayers  = false,
     bool embedRegion   = false,
     bool embedPlatform = false)
 {
     embeds        = new Embeds();
     EmbedGame     = embedGame;
     EmbedCategory = embedCategory;
     EmbedLevel    = embedLevel;
     EmbedPlayers  = embedPlayers;
     EmbedRegion   = embedRegion;
     EmbedPlatform = embedPlatform;
 }
Esempio n. 32
0
 public RunEmbeds(
     bool embedGame = false,
     bool embedCategory = false,
     bool embedLevel = false,
     bool embedPlayers = false,
     bool embedRegion = false,
     bool embedPlatform = false)
 {
     embeds = new Embeds();
     EmbedGame = embedGame;
     EmbedCategory = embedCategory;
     EmbedLevel = embedLevel;
     EmbedPlayers = embedPlayers;
     EmbedRegion = embedRegion;
     EmbedPlatform = embedPlatform;
 }
Esempio n. 33
0
        public async Task GuildInfo()
        {
            try
            {
                var guildDictionary = _utility.GetGuildInfo(Context.Guild);
                var guildInfo       = _utility.ListGuildInfo(guildDictionary);

                var created = Context.Guild.CreatedAt.ToString("f");
                var icon    = Context.Guild.IconUrl;

                await Context.Channel.SendMessageAsync(embed : Embeds.CreateEmbed($"{Context.Guild.Name} Info", guildInfo, $"Created on: {created}", icon));
            }
            catch (Exception e)
            {
                await ReplyAsync(e.Message);
            }
        }
Esempio n. 34
0
            /// <inheritdoc/>
            ITransformationMap <TCollection, TElement> ITransformationMap <TCollection, TElement> .Embed <TMember>(
                string relation,
                Expression <Func <TCollection, TMember> > memberSelector,
                Func <TCollection, ILinkData?> linkSelector)
            {
                switch (memberSelector.Body)
                {
                case MemberExpression me:
                    var valueSelector = memberSelector.Compile();
                    Links[relation] = new LinkInstruction <TCollection>(linkSelector);
                    Embeds.Add(new MemberEmbedInstruction <TCollection, TMember>(relation, me.Member.Name, valueSelector));
                    return(this);

                default:
                    throw new ArgumentException(MalformedValueSelector);
                }
            }
        public LeaderboardEmbeds(
            bool embedGame = false,
            bool embedCategory = false,
            bool embedLevel = false,
            bool embedPlayers = true,
            bool embedRegions = false,
            bool embedPlatforms = false,
            bool embedVariables = false)
        {
            isConstructed = true;

            embeds = new Embeds();
            EmbedGame = embedGame;
            EmbedCategory = embedCategory;
            EmbedLevel = embedLevel;
            EmbedPlayers = embedPlayers;
            EmbedRegions = embedRegions;
            EmbedPlatforms = embedPlatforms;
            EmbedVariables = embedVariables;
        }
Esempio n. 36
0
 public SeriesEmbeds(
     bool embedModerators = false)
 {
     embeds = new Embeds();
     EmbedModerators = embedModerators;
 }