コード例 #1
0
        public async Task <bool> UpdateMobileVerification(string username, VerificationProcess process)
        {
            try
            {
                var request = new UpdateItemRequest
                {
                    TableName = DynamoTableName,
                    Key       = new Dictionary <string, AttributeValue>()
                    {
                        { "Email", new AttributeValue {
                              S = username
                          } }
                    },
                    ExpressionAttributeNames = new Dictionary <string, string>()
                    {
                        { "#MobileProcess", "MobileProcess" },
                        { "#ModifiedOn", "ModifiedOn" }
                    },
                    ExpressionAttributeValues = new Dictionary <string, AttributeValue>()
                    {
                        { ":process", new AttributeValue {
                              S = JsonConvert.SerializeObject(process)
                          } },
                        { ":modifiedOn", new AttributeValue {
                              S = DateTime.UtcNow.ToLongDateString()
                          } }
                    },

                    UpdateExpression = "SET #MobileProcess = :process, #ModifiedOn = :modifiedOn"
                };

                return(await AWS.DynamoDB.UpdateItemAsync(request).ContinueWith(task =>
                {
                    if (task.IsFaulted)
                    {
                        Console.WriteLine(task.Exception.Message);
                    }

                    return !task.IsFaulted;
                }));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
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);
        }
コード例 #3
0
 public bool EndVerification(VerificationProcess process)
 {
     process.Dispose();
     return(VerificationProcesses.TryRemove(process));
 }
コード例 #4
0
 public async Task InvokeVerificationMessageAsync(VerificationProcess process, SocketMessage msg)
 => await VerificationMessage.Invoke(process, msg).ConfigureAwait(false);
コード例 #5
0
 public async Task InvokeVerificationStepAsync(VerificationProcess process, VerificationStep step)
 => await VerificationStep.Invoke(process, step).ConfigureAwait(false);