private async void OnCaptcha(object sender, CaptchaRequiredEventArgs captchaRequiredEventArgs)
        {
            var managerWrapper = (Manager)sender;
            var manager        = managerWrapper.Bot;

            if (manager == null)
            {
                return;
            }

            if (!Plugin.CaptchaModule.Settings.Enabled)
            {
                OnLogEvent(this, new LogModel(LoggerTypes.Warning, "Captcha Module is disabled, stopping account"), manager);
                manager.Stop();
                return;
            }

            if (manager.AccountState == AccountState.CaptchaRequired && manager.State == BotState.Stopped && !manager.LoggedIn)
            {
                await StoppedSolveCaptcha(managerWrapper);

                return;
            }

            if (Plugin.CaptchaModule.Settings.Extra == null)
            {
                return;
            }

            if (managerWrapper.SolvingCaptcha || !manager.CaptchaRequired && !string.IsNullOrEmpty(manager.CaptchaURL))
            {
                return;
            }
            OnLogEvent(this, new LogModel(LoggerTypes.Info, $"Solving captcha at URL: {manager.CaptchaURL}"), manager);

            managerWrapper.SolvingCaptcha = true;
            var results = await CaptchaHandler.Handle(managerWrapper);

            OnLogEvent(this, GetLog(results), manager);
            if (!results.Success)
            {
                manager.Stop();
            }
            managerWrapper.SolvingCaptcha = false;
        }
예제 #2
0
 protected virtual void OnOnCaptchaEvent(object arg1, CaptchaRequiredEventArgs arg2)
 {
     OnCaptchaEvent?.Invoke(arg1, arg2);
 }
예제 #3
0
 private void OnCaptcha(object sender, CaptchaRequiredEventArgs captchaRequiredEventArgs)
 {
     OnOnCaptchaEvent(this, captchaRequiredEventArgs);
 }