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 (PlenteumBot.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", PlenteumBot.botPrefix)); } // Check address validity else if (!PlenteumBot.VerifyAddress(Address)) { await Context.Message.Author.SendMessageAsync(string.Format("Address is not a valid {0} address!", PlenteumBot.coinName)); } // Check that address isn't in use by another user else if (PlenteumBot.CheckAddressExists(Address)) { await Context.Message.Author.SendMessageAsync("Address is in use by another user"); } // Passed checks else { // Register wallet into database string PaymentId = PlenteumBot.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}**", PlenteumBot.coinSymbol, PlenteumBot.tipDefaultAddress, PaymentId); // Send reply await Context.Message.Author.SendMessageAsync("", false, Response.Build()); } }
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 (!PlenteumBot.CheckUserExists(Context.Message.Author.Id)) { await RegisterWalletAsync(Address, Remainder); return; } // Check address validity else if (!PlenteumBot.VerifyAddress(Address)) { await Context.Message.Author.SendMessageAsync(string.Format("Address is not a valid {0} address!", PlenteumBot.coinName)); } // Check that address isn't in use by another user else if (PlenteumBot.CheckAddressExists(Address)) { await Context.Message.Author.SendMessageAsync("Address is in use by another user"); } // Passed checks else { // Update address in database PlenteumBot.UpdateWallet(Context.Message.Author.Id, Address); // Reply with success await Context.Message.Author.SendMessageAsync("Successfully updated your wallet"); } }