Пример #1
0
        public async Task <Message> Collect(string argument, ulong channelId, ulong userId, string username)
        {
            var arguments = argument.ToUpper().TrimStart().Split(' ');

            if (arguments.Length != 1)
            {
                return(_messagesHelper.InvalidArguments(new[] { "<Claim Id>" }, "Collect", "Collect"));
            }

            try
            {
                var collectId = Convert.ToInt32(arguments[0]);
                var reward    = await _coindropConnector.CollectCoinDrop(channelId, collectId);

                if (reward != 0)
                {
                    await _usersConnector.GiveCredits(userId, reward);

                    return(_messagesHelper.CoinDropSuccessful(reward, username));
                }

                return(_messagesHelper.CoinDropTooLate());
            }
            catch (Exception)
            {
                return(_messagesHelper.InvalidArguments(new[] { "<Claim Id>" }, "Collect", "Collect"));
            }
        }