Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions DatabaseMigration/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void Main(string[] args)
}

// Update console
Console.WriteLine("Caching userid {0} with payment id {1}, address {2} and balance {3:N}",
Console.WriteLine("Caching userid {0} with payment id {1}, address {2} and balance {3:N2}",
UserId, Users[UserId].PaymentId, Users[UserId].Address, Users[UserId].Balance);
}
}
Expand All @@ -124,7 +124,7 @@ static void Main(string[] args)
Transactions.Add(Tx, new Transaction(PaymentId, Amount));

// Update console
Console.WriteLine("Caching tx {0} with payment id {1} and amount {2:N}",
Console.WriteLine("Caching tx {0} with payment id {1} and amount {2:N2}",
Tx, PaymentId, Amount);
}
}
Expand Down Expand Up @@ -177,7 +177,7 @@ static void Main(string[] args)
Command.ExecuteNonQuery();

// Update console
Console.WriteLine("Adding user to new db: userid {0} with payment id {1}, address {2} and balance {3:N}",
Console.WriteLine("Adding user to new db: userid {0} with payment id {1}, address {2} and balance {3:N2}",
User.Key, User.Value.PaymentId, User.Value.Address, User.Value.Balance);
}

Expand All @@ -195,7 +195,7 @@ static void Main(string[] args)
Command.ExecuteNonQuery();

// Update console
Console.WriteLine("Adding tx to new db: tx {0} with payment id {1}, amount {2:N}",
Console.WriteLine("Adding tx to new db: tx {0} with payment id {1}, amount {2:N2}",
Transaction.Key, Transaction.Value.PaymentId, Transaction.Value.Amount);
}
}
Expand Down
10 changes: 5 additions & 5 deletions TrtlBotSharp/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public static void Main(string[] args)
{
// Begin bot process in its own thread
RunBotAsync();
while(true)
{

// Wait for keypress to exit
Console.ReadKey();

}
// Close the database connection
CloseDatabase();
}
Expand Down Expand Up @@ -176,7 +176,7 @@ private static async Task ReactionAddedAsync(Cacheable<IUserMessage, ulong> Cach
// Check that user has enough balance for the tip
if (GetBalance(Reaction.UserId) < Convert.ToDecimal(Amount) * TippableUsers.Count + tipFee)
{
await Reaction.User.Value.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N}** {1}",
await Reaction.User.Value.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N2}** {1}",
Convert.ToDecimal(Amount) * TippableUsers.Count + tipFee, coinSymbol));
await Message.AddReactionAsync(new Emoji(tipLowBalanceReact));
return;
Expand Down Expand Up @@ -229,7 +229,7 @@ await Reaction.User.Value.SendMessageAsync(string.Format("Your balance is too lo
// Check that user has enough balance for the tip
if (GetBalance(Reaction.UserId) < Amount + tipFee)
{
await Reaction.User.Value.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N}** {1}",
await Reaction.User.Value.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N2}** {1}",
Amount + tipFee, coinSymbol));
await Message.AddReactionAsync(new Emoji(tipLowBalanceReact));
}
Expand Down
2 changes: 1 addition & 1 deletion TrtlBotSharp/Commands/Informational.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public async Task FaucetAsync([Remainder]string Remainder = "")

// Begin building a response
var Response = new EmbedBuilder();
Response.WithTitle(string.Format("This faucet has {0:N} {1} left", (decimal)FaucetBalance["available"], TrtlBotSharp.coinSymbol));
Response.WithTitle(string.Format("This faucet has {0:N2} {1} left", (decimal)FaucetBalance["available"], TrtlBotSharp.coinSymbol));
Response.WithUrl(TrtlBotSharp.faucetHost);
Response.Description = "```Donations:\n" + TrtlBotSharp.faucetAddress + "```\n";

Expand Down
2 changes: 1 addition & 1 deletion TrtlBotSharp/Commands/Market.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task PriceAsync([Remainder]string Remainder = "")
Response.AddInlineField("Current", string.Format("{0} sats", Math.Round((decimal)CoinPrice["price"] * 100000000)));
Response.AddInlineField("High", string.Format("{0} sats", Math.Round((decimal)CoinPrice["high"] * 100000000)));
Response.AddInlineField(TrtlBotSharp.coinSymbol + "-USD", string.Format("${0:N5} USD", (decimal)CoinPrice["price"] * (decimal)BTCPrice["last"]));
Response.AddInlineField("Volume", string.Format("{0:N} BTC", (decimal)CoinPrice["volume"]));
Response.AddInlineField("Volume", string.Format("{0:N2} BTC", (decimal)CoinPrice["volume"]));
Response.AddInlineField("BTC-USD", string.Format("{0:C} USD", (decimal)BTCPrice["last"]));

// Send reply
Expand Down
2 changes: 1 addition & 1 deletion TrtlBotSharp/Commands/Network.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public async Task SupplyAsync([Remainder]string Remainder = "")
decimal Supply = TrtlBotSharp.GetSupply();

// Send reply
await ReplyAsync(string.Format("The current circulating supply is **{0:N}** {1}", Supply, TrtlBotSharp.coinSymbol));
await ReplyAsync(string.Format("The current circulating supply is **{0:N2}** {1}", Supply, TrtlBotSharp.coinSymbol));
}
}
}
12 changes: 6 additions & 6 deletions TrtlBotSharp/Commands/Tipping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@ public async Task WithdrawAsync(string Amount, [Remainder]string Remainder = "")
// Check that amount is over the minimum fee
else if (Convert.ToDecimal(Amount) < TrtlBotSharp.Minimum)//TrtlBotSharp.Fee)
{
await ReplyAsync(string.Format("Amount must be at least {0:N} {1}", TrtlBotSharp.Minimum/*Fee*/, TrtlBotSharp.coinSymbol));
await ReplyAsync(string.Format("Amount must be at least {0:N2} {1}", TrtlBotSharp.Minimum/*Fee*/, TrtlBotSharp.coinSymbol));
return;
}

// Check if user has enough balance
else if (TrtlBotSharp.GetBalance(Context.Message.Author.Id) < Convert.ToDecimal(Amount) + TrtlBotSharp.tipFee)
{
await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N}** {1}",
await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N2}** {1}",
Convert.ToDecimal(Amount) + TrtlBotSharp.tipFee, TrtlBotSharp.coinSymbol));
await Context.Message.AddReactionAsync(new Emoji(TrtlBotSharp.tipLowBalanceReact));
}
Expand Down Expand Up @@ -277,7 +277,7 @@ public async Task BalanceAsync([Remainder]string Remainder = "")
decimal Balance = TrtlBotSharp.GetBalance(Context.Message.Author.Id);

// Send reply
await Context.Message.Author.SendMessageAsync(string.Format("You have **{0:N}** {1} in your tip jar", Balance, TrtlBotSharp.coinSymbol));
await Context.Message.Author.SendMessageAsync(string.Format("You have **{0:N2}** {1} in your tip jar", Balance, TrtlBotSharp.coinSymbol));
}
}

Expand All @@ -294,7 +294,7 @@ public async Task TipAsync(string Amount, [Remainder]string Remainder = "")
// Check that amount is over the minimum fee
if (Convert.ToDecimal(Amount) < TrtlBotSharp.Minimum)//TrtlBotSharp.Fee)
{
await ReplyAsync(string.Format("Amount must be at least {0:N} {1}", TrtlBotSharp.Minimum/*Fee*/, TrtlBotSharp.coinSymbol));
await ReplyAsync(string.Format("Amount must be at least {0:N2} {1}", TrtlBotSharp.Minimum/*Fee*/, TrtlBotSharp.coinSymbol));
return;
}

Expand Down Expand Up @@ -323,13 +323,13 @@ public async Task TipAsync(string Amount, [Remainder]string Remainder = "")
// Check that user has enough balance for the tip
if (Address == "" && TrtlBotSharp.GetBalance(Context.Message.Author.Id) < Convert.ToDecimal(Amount) * TippableUsers.Count + TrtlBotSharp.tipFee)
{
await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N}** {1}",
await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N2}** {1}",
Convert.ToDecimal(Amount) * TippableUsers.Count + TrtlBotSharp.tipFee, TrtlBotSharp.coinSymbol));
await Context.Message.AddReactionAsync(new Emoji(TrtlBotSharp.tipLowBalanceReact));
}
else if (TrtlBotSharp.GetBalance(Context.Message.Author.Id) < Convert.ToDecimal(Amount) + TrtlBotSharp.tipFee)
{
await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N}** {1}",
await Context.Message.Author.SendMessageAsync(string.Format("Your balance is too low! Amount + Fee = **{0:N2}** {1}",
Convert.ToDecimal(Amount) + TrtlBotSharp.tipFee, TrtlBotSharp.coinSymbol));
await Context.Message.AddReactionAsync(new Emoji(TrtlBotSharp.tipLowBalanceReact));
}
Expand Down
2 changes: 1 addition & 1 deletion TrtlBotSharp/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static string FormatHashrate(decimal Hashrate)
Hashrate /= 1000;
i++;
}
return string.Format("{0:N} {1}", Hashrate, Units[i]);
return string.Format("{0:N2} {1}", Hashrate, Units[i]);
}

// Prettifies a message desription
Expand Down
20 changes: 10 additions & 10 deletions TrtlBotSharp/Wallet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ public static bool Tip(ulong Sender, List<ulong> Recipients, decimal Amount, IMe
AddPending(TransactionHash, GetPaymentId(UID), Amount);

// Set response message
ReplyEmbed.Description = string.Format("You recieved a tip of **{0:N}** {1} from {2}, since you are redirecting tips back to " +
ReplyEmbed.Description = string.Format("You recieved a tip of **{0:N2}** {1} from {2}, since you are redirecting tips back to " +
"your tip jar, this will come through as a deposit once confirmed.\nTX: **{3}**", Amount, coinSymbol,
_client.GetUser(Sender).Username, TransactionHash);
}
else ReplyEmbed.Description = string.Format("You recieved a tip of **{0:N}** {1} from {2}!\nTX: **{3}**", Amount, coinSymbol,
else ReplyEmbed.Description = string.Format("You recieved a tip of **{0:N2}** {1} from {2}!\nTX: **{3}**", Amount, coinSymbol,
_client.GetUser(Sender).Username, TransactionHash);

// Send message
Expand All @@ -84,9 +84,9 @@ public static bool Tip(ulong Sender, List<ulong> Recipients, decimal Amount, IMe
var Response = new EmbedBuilder();
Response.WithTitle("Tip sent!");
if (Recipients.Count == 1)
Response.Description = string.Format("You sent a tip of **{0:N}** {1} to 1 user\nNew balance: **{2:N}** {1}\nTX: **{3}**",
Response.Description = string.Format("You sent a tip of **{0:N2}** {1} to 1 user\nNew balance: **{2:N2}** {1}\nTX: **{3}**",
Amount, coinSymbol, Balance, TransactionHash);
else Response.Description = string.Format("You sent a tip of **{0:N}** {1} to {2} users\nNew balance: **{3:N}** {1}\nTX: **{4}**",
else Response.Description = string.Format("You sent a tip of **{0:N2}** {1} to {2} users\nNew balance: **{3:N2}** {1}\nTX: **{4}**",
Amount, coinSymbol, Recipients.Count, Balance, TransactionHash);

// Send message
Expand Down Expand Up @@ -138,13 +138,13 @@ public static bool Tip(ulong Sender, string Recipient, decimal Amount)
if (GetAddress(Sender) == Recipient)
{
Response.WithTitle("Withdrawal sent!");
Response.Description = string.Format("You withdrew **{0:N}** {1} to {2}\nNew balance: **{3:N}** {1}\nTX: **{4}**",
Response.Description = string.Format("You withdrew **{0:N2}** {1} to {2}\nNew balance: **{3:N2}** {1}\nTX: **{4}**",
Amount, coinSymbol, Recipient, Balance, TransactionHash);
}
else
{
Response.WithTitle("Tip sent!");
Response.Description = string.Format("You sent a tip of **{0:N}** {1} to {2}\nNew balance: **{3:N}** {1}\nTX: **{4}**",
Response.Description = string.Format("You sent a tip of **{0:N2}** {1} to {2}\nNew balance: **{3:N2}** {1}\nTX: **{4}**",
Amount, coinSymbol, Recipient, Balance, TransactionHash);
}

Expand Down Expand Up @@ -206,7 +206,7 @@ public static async void BeginMonitoring()

// Get last sync height
int SyncHeight = GetSyncHeight();
Log(0, "Wallet", "Starting sync, {0:N0} blocks behind", ((int)Result["blockCount"] - SyncHeight));
Log(0, "Wallet", "Starting sync, {0:N2} blocks behind", ((int)Result["blockCount"] - SyncHeight));

// Loop while connected
while (Result.Count > 0 && !Result.ContainsKey("error"))
Expand All @@ -226,7 +226,7 @@ public static async void BeginMonitoring()
while (SyncHeight < CurrentHeight)
{
// Log that syncing has started
Log(1, "Wallet", "Scanning for deposits from height: {0:N0}", SyncHeight);
Log(1, "Wallet", "Scanning for deposits from height: {0:N2}", SyncHeight);

// Set sync chunk size
int SyncSize = 1000;
Expand Down Expand Up @@ -340,7 +340,7 @@ public static async void BeginMonitoring()
// Begin building a message
var Response = new EmbedBuilder();
Response.WithTitle("Deposit recieved!");
Response.Description = string.Format("Your deposit of **{0:N}** {1} has now been credited.\nNew balance: **{2:N}** {1}\nTX: **{3}**",
Response.Description = string.Format("Your deposit of **{0:N2}** {1} has now been credited.\nNew balance: **{2:N2}** {1}\nTX: **{3}**",
Difference, coinSymbol, Balance, ConfirmedTransaction.Key);

// Send message
Expand Down Expand Up @@ -383,7 +383,7 @@ public static async void BeginMonitoring()
// Begin building a message
var Response = new EmbedBuilder();
Response.WithTitle("Tip processed!");
Response.Description = string.Format("A tip of **{0:N}** {1} that was sent to you has now been credited.\nNew balance: **{2:N}** {1}\nTX: **{3}**",
Response.Description = string.Format("A tip of **{0:N2}** {1} that was sent to you has now been credited.\nNew balance: **{2:N2}** {1}\nTX: **{3}**",
Pending, coinSymbol, Balance + Pending, ConfirmedTransaction.Key);

// Send message
Expand Down