Esempio n. 1
0
        public async Task UpdateWalletAsync(string Address, [Remainder] string Remainder = "")
        {
            // Delete original message
            try { await Context.Message.DeleteAsync(); }
            catch { }

            // Check that user has registered an address, register it if not.
            if (!TrtlBotSharp.CheckUserExists(Context.Message.Author.Id))
            {
                await RegisterWalletAsync(Address, Remainder);

                return;
            }

            // Check address validity
            else if (!TrtlBotSharp.VerifyAddress(Address))
            {
                await Context.Message.Author.SendMessageAsync(string.Format("Address is not a valid {0} address!", TrtlBotSharp.coinName));
            }

            // Check that address isn't in use by another user
            else if (TrtlBotSharp.CheckAddressExists(Address))
            {
                await Context.Message.Author.SendMessageAsync("Address is in use by another user");
            }

            // Passed checks
            else
            {
                // Update address in database
                TrtlBotSharp.UpdateWallet(Context.Message.Author.Id, Address);

                // Reply with success
                await Context.Message.Author.SendMessageAsync("Successfully updated your wallet");
            }
        }