[Command("wallet")] // Get by mention public async Task WalletAsync(SocketUser User, [Remainder] string Remainder = "") { // Delete original message try { await Context.Message.DeleteAsync(); } catch { } // Try to grab address from the database string Address = ""; if (PlenteumBot.CheckUserExists(User.Id)) { Address = PlenteumBot.GetAddress(User.Id); } // Check if result is empty if (string.IsNullOrEmpty(Address)) { await Context.Message.Author.SendMessageAsync(string.Format("{0} hasn't registered a wallet!", User.Username)); } // Check if user is requesting their own wallet else if (User == null || Context.Message.Author.Id == User.Id) { await Context.Message.Author.SendMessageAsync(string.Format("**Your wallet:**```{0}```", Address)); } // User is requesting someone else's wallet else { await Context.Message.Author.SendMessageAsync(string.Format("**{0}'s wallet:**```{1}```", User.Username, Address)); } }
[Command("wallet")] // Get own wallet public async Task WalletAsync([Remainder] string Remainder = "") { // Delete original message try { await Context.Message.DeleteAsync(); } catch { } // Try to grab address from the database string Address = ""; if (PlenteumBot.CheckUserExists(Context.Message.Author.Id)) { Address = PlenteumBot.GetAddress(Context.Message.Author.Id); } // Check if result is empty if (string.IsNullOrEmpty(Address)) { await Context.Message.Author.SendMessageAsync(string.Format("You haven't registered a wallet! Use {0}help if you need any help.", PlenteumBot.botPrefix)); } // Check if user is requesting their own wallet else { await Context.Message.Author.SendMessageAsync(string.Format("**Your wallet:**```{0}```", Address)); } }
public async Task WithdrawAsync(string Amount, [Remainder] string Remainder = "") { // Delete original message try { await Context.Message.DeleteAsync(); } catch { } // Check if user exists in user table if (!PlenteumBot.CheckUserExists(Context.Message.Author.Id)) { await Context.Message.Author.SendMessageAsync(string.Format("You must register a wallet before you can withdraw! Use {0}help if you need any help.", PlenteumBot.botPrefix)); return; } // Check that amount is over the minimum fee else if (Convert.ToDecimal(Amount) < PlenteumBot.Minimum)//PlenteumBot.Fee) { await ReplyAsync(string.Format("Amount must be at least {0:N} {1}", PlenteumBot.Minimum /*Fee*/, PlenteumBot.coinSymbol)); return; } // Check if user has enough balance else if (PlenteumBot.GetBalance(Context.Message.Author.Id) < Convert.ToDecimal(Amount) + PlenteumBot.tipFee) { await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N}** {1}", Convert.ToDecimal(Amount) + PlenteumBot.tipFee, PlenteumBot.coinSymbol)); await Context.Message.AddReactionAsync(new Emoji(PlenteumBot.tipLowBalanceReact)); } // Send withdrawal else if (PlenteumBot.Tip(Context.Message.Author.Id, PlenteumBot.GetAddress(Context.Message.Author.Id), Convert.ToDecimal(Amount))) { // Send success react await Context.Message.AddReactionAsync(new Emoji(PlenteumBot.tipSuccessReact)); } }