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

            // Check that user hasn't already registered an address
            if (TrtlBotSharp.CheckUserExists(Context.Message.Author.Id))
            {
                await Context.Message.Author.SendMessageAsync(string.Format("You have already registered an address, use {0}updatewallet if you'd like to update it", TrtlBotSharp.botPrefix));
            }

            // 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
            {
                // Register wallet into database
                string PaymentId = TrtlBotSharp.RegisterWallet(Context.Message.Author.Id, Address);

                // Begin building a response
                var Response = new EmbedBuilder();
                Response.WithTitle("Successfully registered your wallet!");
                Response.Description = string.Format("Deposit {0} to start tipping!\n\n" +
                                                     "Address:\n**{1}**\n\nPayment ID:\n**{2}**", TrtlBotSharp.coinSymbol, TrtlBotSharp.tipDefaultAddress, PaymentId);

                // Send reply
                await Context.Message.Author.SendMessageAsync("", false, Response);
            }
        }