Example #1
0
        public async Task <Embed> GetFashionReport()
        {
            List <FashionReportEntry> reports = await FashionReportAPI.Get();

            reports.Sort((a, b) =>
            {
                return(a.Time.CompareTo(b.Time));
            });

            foreach (FashionReportEntry entry in reports)
            {
                if (entry.Id == null)
                {
                    continue;
                }

                return(this.GetEmbed(entry));
            }

            throw new UserException("I couldn't find any Fashion Report posts.");
        }
Example #2
0
        private async Task Update()
        {
            List <FashionReportEntry> reports = await FashionReportAPI.Get();

            foreach (FashionReportEntry entry in reports)
            {
                if (entry.Id == null)
                {
                    continue;
                }

                FashionReportEntry?saved = await this.db.Load(entry.Id);

                if (saved == null)
                {
                    await this.Post(entry);

                    await this.db.Save(entry);
                }
            }
        }
Example #3
0
        public async Task GetFashionReport(CommandMessage message)
        {
            List <FashionReportEntry> reports = await FashionReportAPI.Get();

            reports.Sort((a, b) =>
            {
                return(a.Time.CompareTo(b.Time));
            });

            foreach (FashionReportEntry entry in reports)
            {
                if (entry.Id == null)
                {
                    continue;
                }

                await message.Channel.SendMessageAsync(embed : this.GetEmbed(entry), messageReference : message.MessageReference);

                return;
            }

            throw new UserException("I couldn't find any Fashion Report posts.");
        }