Ejemplo n.º 1
0
        public async Task ExcuseUserAsync(IUser user = null,
                                          [CallFlag('i', "id", Flag.EXCUSE_I)] ulong?excuseId = null)
        {
            user = user ?? Author;

            if (user?.Id == BotUser.Id)
            {
                await ReplyAsync(ExcuseText.SELF);

                return;
            }

            var excuse = GetExcuse(excuseId, true) ?? GetExcuse(null, true);

            var submitter = Client.GetUser(excuse.CreatorId);

            var builder = new LocalisedEmbedBuilder
            {
                Author    = LocalisedAuthorBuilder.FromUser(submitter),
                Footer    = new LocalisedFooterBuilder().WithText(ExcuseText.ID, excuse.Id),
                Timestamp = DateTime.Now.AddSeconds(-new Random().Next(120, 3600)),
                Color     = System.Drawing.Color.Green.ToDiscord(),
            }.WithRawDescription(excuse.ExcuseText);

            await ReplyAsync(ExcuseText.REASON, builder, user.Id);
        }
Ejemplo n.º 2
0
        async Task ViewRegistrationAsync(ulong?guildId, IUser user, bool global)
        {
            Registration current = GetRegistrations(Guild.Id, Author.Id, global).OrderByDescending(r => r.EditTime).FirstOrDefault();
            PlayerData   player  = GetPlayers(Author.Id).FirstOrDefault();

            if (current == null)
            {
                if (user.Id == Author.Id)
                {
                    await ReplyAsync(ApplyText.VIEW_NOTREGISTERED, ReplyType.Error);
                }
                else if (global)
                {
                    await ReplyAsync(ApplyText.VIEW_GLOBAL_NOTREGISTERED, ReplyType.Error);
                }
                else
                {
                    await ReplyAsync(ApplyText.VIEW_GUILD_NOTREGISTERED, ReplyType.Error);
                }
                return;
            }

            var builder = new LocalisedEmbedBuilder
            {
                Author      = LocalisedAuthorBuilder.FromUser(Author),
                Color       = System.Drawing.Color.SkyBlue.ToDiscord(),
                Description = (RawString)current.Message,
                Footer      = new LocalisedFooterBuilder().WithText(current.GuildId == null ? ApplyText.VIEW_FOOTER_GLOBAL : ApplyText.VIEW_FOOTER_GUILD, current.ApplyTime, current.EditTime)
            }.WithTitle(ApplyText.VIEW_TITLE)
            .AddInlineField(f => f.WithName(MAXSTAGE).WithValue(player.MaxStage))
            .AddInlineField(f => f.WithName(RELICS).WithValue(player.Relics))
            .AddInlineField(f => f.WithName(ATTACKSPERWEEK).WithValue(player.AttacksPerWeek))
            .AddInlineField(f => f.WithName(TAPSPERCQ).WithValue(player.TapsPerCQ));

            if (current.Images == null)
            {
                builder.AddField(f => f.WithName(IMAGES).WithValue(NONE));
            }
            else
            {
                builder.AddField(f => f.WithName(IMAGES).WithValues("\n", current.Images.Select(i => i.AbsoluteUri)));
            }

            await ReplyAsync(builder);
        }