Пример #1
0
        public async Task StartVerificationAsync(IGuildUser guildUser)
        {
            if (VerificationProcesses.Any(vp => vp.GuildUser == guildUser))
            {
                throw new UserAlreadyVerifyingException();
            }

            using (var uow = _db.UnitOfWork) {
                if (uow.VerifiedUsers.IsVerified(guildUser.GuildId, guildUser.Id))
                {
                    throw new UserAlreadyVerifiedException();
                }
            }

            var verificationProcess = new VerificationProcess(guildUser, _client, _db, this, _stringService, _fs);

            try {
                await verificationProcess.StartAsync();
            } catch (Exception) {
                verificationProcess.Dispose();
                throw;
            }
            VerificationProcesses.Add(verificationProcess);
        }
Пример #2
0
 public bool EndVerification(VerificationProcess process)
 {
     process.Dispose();
     return(VerificationProcesses.TryRemove(process));
 }