Exemple #1
0
        private static void CAPTCHATypeSwitch(ref CaptchaLogInfo info)
        {
            switch (info.t)
            {
            case CaptchaType.Completed:
                info.result = "CAPTCHA Completed";
                info.color  = new Color(0, 150, 0);
                break;

            case CaptchaType.Failed:
                info.result = "CAPTCHA Attempt Failed";
                info.color  = new Color(255, 12, 12);
                break;

            case CaptchaType.OutOfAttempts:
                info.result = "CAPTCHA Failed";
                info.color  = new Color(130, 0, 0);
                break;

            case CaptchaType.Requested:
            default:
                info.result = "CAPTCHA Sent";
                info.color  = SecurityInfo.botColor;
                break;
            }
        }
Exemple #2
0
        private static async Task SendToCaptchaLogAsync(CaptchaLogInfo info)
        {
            SocketTextChannel channel = await modLogsDatabase.CaptchaLogChannel.GetCaptchaLogChannelAsync(info.user.Guild);

            if (channel == null)
            {
                return;
            }

            EmbedBuilder embed = new EmbedBuilder()
                                 .WithColor(info.color)
                                 .WithTitle($"Federal Bureau of Investigation - {info.result}")
                                 .WithCurrentTimestamp();

            EmbedFieldBuilder captchaResult = new EmbedFieldBuilder()
                                              .WithIsInline(true)
                                              .WithName("User")
                                              .WithValue(info.user.Mention);

            embed.AddField(captchaResult);

            if (info.attempts != 0)
            {
                EmbedFieldBuilder attempts = new EmbedFieldBuilder()
                                             .WithIsInline(false)
                                             .WithName("Attempts:")
                                             .WithValue($"{info.attempts}/5");
                embed.AddField(attempts);
            }

            EmbedFieldBuilder captchaCode = new EmbedFieldBuilder()
                                            .WithIsInline(true)
                                            .WithName("Looking for")
                                            .WithValue(info.code);

            embed.AddField(captchaCode);

            if (info.given != null)
            {
                EmbedFieldBuilder resultGiven = new EmbedFieldBuilder()
                                                .WithIsInline(true)
                                                .WithName("Given")
                                                .WithValue(info.given);
                embed.AddField(resultGiven);
            }

            await channel.SendMessageAsync(embed : embed.Build());
        }