public async Task LinkEth([Remainder] string address) { NanoPool.UserAccount account = NanoPool.GetUser(Context.User, address); string msg = ""; if (account == null) { msg = "Account **" + address + "**\nNot Found!"; await PrintEmbedMessage("ETH Link Failed", msg); return; } if (account.discordID != Context.User.Id) { msg += "**Address:** " + account.address; msg += "\n**Already Linked:** " + account.discordUsername; } else { msg += "**Address:** " + account.address; msg += "\n**Now Linked:** " + account.discordUsername; } await PrintEmbedMessage("ETH Address Linked", msg); //await Context.Channel.SendMessageAsync(msg); }
void Update_nano() { string address = textBox2.Text; int hr = Convert.ToInt32(textBox1.Text); float balance = NanoPool.get_Balance(address); float eth_USD_Price = NanoPool.get_eth_usd_rate(); SetText_balance_lbl(balance.ToString()); SetText_curr_hashrate_lbl(NanoPool.get_CurrentHashrate(address).ToString()); SetText_hashrate_1hr_lbl(NanoPool.get_Hashrate(address, 1).ToString()); SetText_hashrate_3hr_lbl(NanoPool.get_Hashrate(address, 3).ToString()); SetText_hashrate_6hr_lbl(NanoPool.get_Hashrate(address, 6).ToString()); SetText_hashrate_12hr_lbl(NanoPool.get_Hashrate(address, 12).ToString()); SetText_hashrate_24hr_lbl(NanoPool.get_Hashrate(address, 24).ToString()); SetText_hashrate_nhr_lbl(NanoPool.get_Hashrate(address, hr).ToString()); SetText_usd_balance_lbl(Convert.ToString(balance * eth_USD_Price)); SetText_eth_price_lbl(eth_USD_Price.ToString()); if (Do_ssh) { SSH.Nvidia_Info nv_info = SSH.Get_Nvidia_Info(Connection_Info); SetText_fan_perc_lbl(nv_info.Fan_percent.ToString() + "%"); SetText_nv_tmp_lbl(nv_info.Temp.ToString() + "C"); SetText_nv_pw_lbl(nv_info.Power_consumtion.ToString() + "W/" + nv_info.Power_Limit.ToString() + "W"); SetText_nv_mem_lbl(nv_info.Mem_Usage.ToString() + "MiB/" + nv_info.Mem_Limit.ToString() + "MiB"); SetText_nv_usage_lbl(nv_info.GPU_Util + "%"); } }
public async Task Nanopool(SocketUser user) { NanoPool.UserAccount userAccount = NanoPool.GetUser(user); string address = userAccount.address; await PrintEmbedMessage("NanoPool Account", GetNanoPoolInfo(address, user)); }
public async Task Ethbal([Remainder] string address = null) { NanoPool.UserAccount account = NanoPool.GetUser(Context.User, address); string msg = ""; if (account == null) { msg = "Account **" + address + "**\nNot Found! Please use linketh cmd or enter an address to link!"; await PrintEmbedMessage("Account Retrieval Failed", msg); return; } if (address == null) { address = account.address; } double balance = double.Parse(EtherScan.GetBalance(address)) / 1000000000000000000d; NanoPool.Prices prices = NanoPool.GetPrices(); double usdBal = prices.price_usd * balance; double btcBal = prices.price_btc * balance; double gbpBal = prices.price_gbp * balance; double eurBal = prices.price_eur * balance; msg += "**Account:** " + address; msg += "\n**Balance:** " + string.Format("{0:N15} ETH", balance); msg += "\n**USD Value:** " + string.Format("${0:N2}", usdBal); msg += "\n**BTC Value:** " + string.Format("{0:N8} BTC", btcBal); await PrintEmbedMessage("Ethereum Balance", msg); //await Context.Channel.SendMessageAsync(msg); }
public string GetNanoPoolInfo(string address, SocketUser user) { NanoPool.Account account = NanoPool.GetAccount(address, user); string msg = ""; if (account == null) { msg = "Account **" + address + "**\nNot Found!"; return(msg); } msg += "**Account:** " + account.account; msg += "\n**Unconfirmed Balance:** " + account.unconfirmed_balance; msg += "\n**Balance:** " + account.balance; double balance = double.Parse(account.balance); NanoPool.Prices prices = NanoPool.GetPrices(); double usdBal = prices.price_usd * balance; double btcBal = prices.price_btc * balance; double gbpBal = prices.price_gbp * balance; double eurBal = prices.price_eur * balance; msg += "\n**USD Value:** " + string.Format("${0:N2}", usdBal); msg += "\n**BTC Value:** " + string.Format("{0:N8} BTC", btcBal); msg += "\n**Hashrate:** " + account.hashrate + " Mh/s"; msg += "\n\n__Average Hashrate__"; msg += "\n**1 Hour:** " + account.avgHashrate["h1"] + " Mh/s"; msg += "\n**3 Hours:** " + account.avgHashrate["h3"] + " Mh/s"; msg += "\n**6 Hours:** " + account.avgHashrate["h6"] + " Mh/s"; msg += "\n**12 Hours:** " + account.avgHashrate["h12"] + " Mh/s"; msg += "\n**24 Hours:** " + account.avgHashrate["h24"] + " Mh/s"; msg += "\n\n__Workers__"; for (int i = 0; i < account.workers.Count; i++) { if (i > 0) { msg += "\n"; } msg += "\n**ID:** " + account.workers[i].id; msg += "\n**UID:** " + account.workers[i].uid; msg += "\n**Hashrate:** " + account.workers[i].hashrate + " Mh/s"; msg += "\n**Last Share:** " + SteamAccounts.UnixTimeStampToDateTime(account.workers[i].lastshare); msg += "\n**Rating:** " + account.workers[i].rating; /* * msg += "\n**1hr Avg Hashrate:** " + account.workers[i].h1 + " Mh/s"; * msg += "\n**3hr Avg Hashrate:** " + account.workers[i].h3 + " Mh/s"; * msg += "\n**6hr Avg Hashrate:** " + account.workers[i].h6 + " Mh/s"; * msg += "\n**12hr Avg Hashrate:** " + account.workers[i].h12 + " Mh/s"; * msg += "\n**24hr Avg Hashrate:** " + account.workers[i].h24 + " Mh/s"; */ } return(msg); }
static void Main(string[] args) { Console.WriteLine("Welcome to Trade_or_Not\n" + " Grabbing Ethereum Price vs USD and vs BTC..."); try { float usd_price = NanoPool.get_eth_usd_rate(); float btc_price = NanoPool.get_eth_btc_rate(); Console.WriteLine(" USD Price : " + usd_price.ToString()); Console.WriteLine(" BTC Price : " + btc_price.ToString()); Console.WriteLine(" Enter number pertaining to what you want to trade:"); Console.WriteLine("1) ETH to USD to ETH\n" + "2) ETH to BTC to ETH\n" + "3) USD to ETH to USD\n" + "4) BTC to ETH to BTC"); char Char = Console.ReadKey().KeyChar; if (Char == '1') { do_Calculations("ETH", "USD", usd_price); } else if (Char == '2') { do_Calculations("ETH", "BTC", btc_price); } else if (Char == '3') { do_Calculations("USD", "ETH", 1 / usd_price); } else if (Char == '4') { do_Calculations("BTC", "ETH", 1 / btc_price); } else { Console.WriteLine("Error: Invalid Input\nExiting... "); Environment.Exit(1); } Console.ReadKey(); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); Console.WriteLine("Exiting... "); Environment.Exit(1); } }
public List <Pool> GetPools() { List <Pool> pools = new List <Pool>(); try { Pool pool1 = new FlyPool("Flypool", "eu1-zcash.flypool.org:3333"); Pool pool2 = new NanoPool("Nanopool", "zec-us-east1.nanopool.org:6666"); pools.Add(pool1); pools.Add(pool2); return(pools); } catch (Exception e) { } return(pools); }
public List <Pool> GetPools() { List <Pool> pools = new List <Pool>(); try { Pool pool1 = new MoneroPool("MoneroPool", "stratum+tcp://mine.moneropool.com:3333"); Pool pool2 = new NanoPool("Nanopool", "stratum+ssl://xmr-eu1.nanopool.org:14433"); pools.Add(pool1); pools.Add(pool2); return(pools); } catch (Exception e) { } return(pools); }
private async Task Client_MessageReceived(SocketMessage s) { var msg = s as SocketUserMessage; if (msg == null) { return; } var context = new SocketCommandContext(client, msg); ulong guildID = 0; SocketTextChannel generalchan = null; ServerConfig config = new ServerConfig(); UserAccount userAccount = null; Antispam.SpamAccount spamAccount = null; //Load Accounts UserAccounts.LoadUserAccts(); SteamAccounts.LoadUserAccts(); ServerConfigs.LoadServerConfigs(); NanoPool.LoadAccounts(); MemeLoader.LoadMemes(); Antispam.LoadSpamAccount(); GiveawayManager.LoadGiveaways(); //----------Do Tests-------- //if (!context.IsPrivate) await RepeatingTimer.UpdateAuditLog(context.Guild);] //Mute Check userAccount = UserAccounts.GetAccount(context.User); spamAccount = Antispam.GetAccount(context.User); if (oldMessage.Count > 0) { if (oldMessage[oldMessage.Count - 1].Content == s.Content) { for (int i = 0; i < oldMessage.Count; i++) { if (oldMessage[i].Content == s.Content && oldMessage[i].Embeds.Count == 0) { msgCount++; if (msgCount >= 5) { try { await s.DeleteAsync(); } catch (Exception ex) { string exMsg = DateTime.Now + " | EXCEPTION: " + ex.Message; Console.WriteLine(exMsg); Log.LogException(exMsg); } string mes = DateTime.Now + " | " + context.User + " suspected raid account. Ban request...."; Console.WriteLine(mes); } } } } } if (oldMessage.Count >= 20) { oldMessage.RemoveAt(0); } oldMessage.Add(s); if (!context.IsPrivate) { config = ServerConfigs.GetConfig(context.Guild); RepeatingTimer.channel = (SocketTextChannel)context.Channel; if (!updated.Contains(context.Guild)) { ServerConfigs.UpdateServerConfig(context.Guild, config); updated.Add(context.Guild); } if (config.RequiresVerification) { if (GetTChannel(context.Guild.TextChannels, "verification") == null) { await context.Guild.CreateTextChannelAsync("verification"); } } if (userAccount.IsMuted) { await context.Message.DeleteAsync(); return; } //Get Guild ID guildID = context.Guild.Id; DataStorage.AddPairToStorage(context.Guild.Name + "ID", guildID.ToString()); generalchan = GetTChannel(context.Guild.TextChannels, "general"); } //Bot Check if (!context.User.IsBot) { if (!context.IsPrivate) { if (!config.AllowAdvertising) { if (context.Message.Content.Contains(context.Guild.EveryoneRole.ToString()) && context.Message.Content.Contains("https://discord.gg/")) { await context.Message.DeleteAsync(); await context.Channel.SendMessageAsync(context.User.Mention + " Advertising discord servers is not allowed here."); return; } } if (config.BlockMentionEveryone) { if (context.Message.Content.Contains(context.Guild.EveryoneRole.ToString())) { await context.Message.DeleteAsync(); await context.Channel.SendMessageAsync(context.User.Mention + " mentioning everyone is prohibited!"); return; } } //Check for raid from multiple account spam //Add when you wake up... spamAccount.LastMessages.Add(DateTime.Now); if (spamAccount.BanAmount > 0) { if (Math.Abs(spamAccount.LastBan.Subtract(DateTime.Now).Days) > 10) //Reset ban amount after 10 days { spamAccount.BanAmount = 0; } } if (spamAccount.LastMessages.Count > 3) { //Get last 4 messages sent DateTime d1 = spamAccount.LastMessages[0]; DateTime d2 = spamAccount.LastMessages[1]; DateTime d3 = spamAccount.LastMessages[2]; DateTime d4 = spamAccount.LastMessages[3]; TimeSpan t1 = new TimeSpan(); TimeSpan t2 = new TimeSpan(); TimeSpan t3 = new TimeSpan(); //Subtract them from each other by Milliseconds t1 = d1.Subtract(d2); t2 = d2.Subtract(d3); t3 = d3.Subtract(d4); double mil1 = Math.Abs(t1.TotalMilliseconds); double mil2 = Math.Abs(t2.TotalMilliseconds); double mil3 = Math.Abs(t3.TotalMilliseconds); //Console.WriteLine(mil1 + "\n" + mil2 + "\n" + mil3); //If all past 4 messages are within spam threshold then its considerd spam if (mil1 <= Antispam.millisecondThreshold && //Threshold is 5 seconds mil2 <= Antispam.millisecondThreshold && mil3 <= Antispam.millisecondThreshold) { spamAccount.BanAmount++; string message = ""; DateTime banTime = DateTime.Now; if (spamAccount.BanAmount < config.AntiSpamWarn) { message = "\nPlease stop spamming you have been muted for 30 seconds!"; banTime = DateTime.Now.AddSeconds(30); } if (spamAccount.BanAmount >= config.AntiSpamWarn && spamAccount.BanAmount < config.AntiSpamThreshold) { int time = (int)config.AntiSpamTime; message = "\nYou have been muted for " + time + " Minutes! " + context.Guild.Owner.Mention; banTime = DateTime.Now.AddMinutes(time); } if (spamAccount.BanAmount > config.AntiSpamThreshold) { SocketGuildUser user = (SocketGuildUser)context.User; await user.BanAsync(1, "Spamming"); await context.Channel.SendMessageAsync(context.User.Username + " was banned for 1 day for spamming!"); return; } spamAccount.BanTime = banTime; spamAccount.LastBan = DateTime.Now; await context.Channel.SendMessageAsync(context.User.Mention + message); spamAccount.LastMessages.Clear(); Antispam.UpdateAccount(context.User, spamAccount); Antispam.SaveAccounts(); userAccount.IsMuted = true; UserAccounts.SaveAccounts(); return; } spamAccount.LastMessages.Clear(); } Antispam.SaveAccounts(); if (config.EnableServerStats) { //If stat channels dont exist await CreateStatChannels(context.Guild); await updMemberChan(context.Guild); //Update Stat channels } if (config.EnableLevelSystem) { uint oldlvl = userAccount.LevelNumber; userAccount.XP += 10; //Xp gain userAccount.Points += 10; //Pointshop if (oldlvl != userAccount.LevelNumber) { for (int i = 0; i < LevelingSytem.levelUp.Length; i++) { if (userAccount.LevelNumber == LevelingSytem.levelUp[i]) { IGuildUser user = (IGuildUser)context.User; IRole[] r = user.Guild.Roles.ToArray(); IRole addrole = null; for (int i2 = 0; i2 < r.Length; i2++) { if (r[i2].Name.ToLower() == LevelingSytem.upgradeRoles[i].ToLower()) { addrole = r[i2]; break; } } if (addrole != null) { ulong?roleID = null; foreach (ulong r2 in user.RoleIds) { if (r2 == addrole.Id) { roleID = r2; break; } }//end foreach loop if (roleID == null) { await user.AddRoleAsync(addrole); await context.Channel.SendMessageAsync("__" + user.Username + "__ earned role **" + addrole + "**!", false); } //end if roleID } //end if addrole != null } // end if level up } //end levels loop string message = "Congrats " + context.User.Mention + ", You just advanced to **Level " + userAccount.LevelNumber + "!**"; await context.Channel.SendMessageAsync(message); } //end level check } //end level system check } //end if EnableLevelSystem UserAccounts.SaveAccounts(); } //end isPrivate check int argPos = 0; if (msg.HasStringPrefix("" + config.Prefix, ref argPos) || msg.HasMentionPrefix(client.CurrentUser, ref argPos)) { if (context.IsPrivate) { config = new ServerConfig(); } else { config = ServerConfigs.GetConfig(context.Guild); } IResult result = null; result = await service.ExecuteAsync(context, argPos, null); if (!result.IsSuccess && result.Error != CommandError.UnknownCommand) { bool errorCheck = true; if (context.Message.Content.Contains("creatememe") && context.Message.Attachments.Count > 0) { if (result.ErrorReason.Contains("User not found")) { errorCheck = false; } } if (errorCheck) { string message = "Error when running this command\n**" + result.ErrorReason + "**\n\nView console for more info"; var embed = new EmbedBuilder(); embed.WithTitle("Command Error"); embed.WithDescription(message); embed.WithColor(config.EmbedColorRed, config.EmbedColorGreen, config.EmbedColorBlue); if (config.FooterText != "") { embed.WithFooter(config.FooterText); } if (config.TimeStamp) { embed.WithCurrentTimestamp(); } await context.Channel.SendMessageAsync("", false, embed.Build()); Console.WriteLine(result.ErrorReason); Console.WriteLine(result.Error); } } } GetAllVoiceChannels(context.Guild.VoiceChannels); GetAllTextChannels(context.Guild.TextChannels); }
public async Task CalcETH(float hashrate) { List <NanoPool.Amount> amounts = NanoPool.CalculateEth(hashrate); string msg = ""; EmbedField[] fields = new EmbedField[6]; int count = 0; int num = 0; foreach (NanoPool.Amount amount in amounts) { switch (num) { case 0: { fields[0].name = "__Minute__"; //msg += "\n\n__Minute__"; break; } case 1: { fields[1].name = "__Hour__"; //msg += "\n\n__Hour__"; break; } case 2: { fields[2].name = "__Day__"; //msg += "\n\n__Day__"; break; } case 3: { fields[3].name = "__Week__"; //msg += "\n\n__Week__"; break; } case 4: { fields[4].name = "__Month__"; //msg += "\n\n__Month__"; break; } case 5: { fields[5].name = "__Year__"; //msg += "\n\n__Month__"; break; } } msg = "**Coins:** " + string.Format("{0:N10}", amount.coins); msg += "\n**Dollars:** " + string.Format("${0:N8}", amount.dollars); msg += "\n**Bitcoins:** " + string.Format("{0:N10}", amount.bitcoins); msg += "\n**Euros:** " + string.Format("€{0:N8}", amount.euros); msg += "\n**Pounds:** " + string.Format("£{0:N8}", amount.pounds); fields[num].value = msg; num++; count++; if (count >= 6) { //msg += "|"; count = 0; } } //string[] split = msg.Split('|'); //for (int i = 0; i < split.Length; i++) { await PrintEmbedMessage("ETH Calculator " + hashrate + " Mh/s", fields : fields); } //await Context.Channel.SendMessageAsync(msg); }
public async Task EthTokens([Remainder] string address = null) { NanoPool.UserAccount account = NanoPool.GetUser(Context.User, address); string msg = ""; if (account == null) { msg = "Account **" + address + "**\nNot Found! Please use linketh cmd or enter an address to link!"; await PrintEmbedMessage("Account Retrieval Failed", msg); return; } if (address == null) { address = account.address; } List <EtherScan.Token> tokens = EtherScan.GetTokens(address); string symbols = ""; int count = 0; foreach (EtherScan.Token token in tokens) { if (token.tokenSymbol != "" && !token.tokenName.ToLower().Contains("promo")) { if (count == 1) { symbols += ","; count = 0; } symbols += token.tokenSymbol; count++; } } Dictionary <string, CoinMarketCap.Currency> currencies = CoinMarketCap.GetTokens(symbols); count = 0; int num = 0; msg += "**Account:** " + address; double totalValue = 0; foreach (EtherScan.Token token in tokens) { int decPlace = 0; if (token.tokenDecimal != "0" && token.tokenDecimal != "") { decPlace = int.Parse(token.tokenDecimal); } double div = 1; for (int i = 0; i < decPlace; i++) { div *= 10d; } double balance = double.Parse(token.value) / div; if (currencies.ContainsKey(token.tokenSymbol)) { totalValue += currencies[token.tokenSymbol].quote.USD.price * balance; } } msg += string.Format("\n**Total Value:** ${0:N5}", totalValue); foreach (EtherScan.Token token in tokens) { int decPlace = 0; if (token.tokenDecimal != "0" && token.tokenDecimal != "") { decPlace = int.Parse(token.tokenDecimal); } double div = 1; for (int i = 0; i < decPlace; i++) { div *= 10d; } msg += "\n\n**Name:** " + token.tokenName; msg += "\n**Symbol:** " + token.tokenSymbol; double balance = double.Parse(token.value) / div; if (decPlace == 0) { msg += "\n**Balance:** " + string.Format("{0:N0} " + token.tokenSymbol, balance); } if (decPlace == 8) { msg += "\n**Balance:** " + string.Format("{0:N8} " + token.tokenSymbol, balance); } if (decPlace == 18) { msg += "\n**Balance:** " + string.Format("{0:N15} " + token.tokenSymbol, balance); } if (currencies.ContainsKey(token.tokenSymbol)) { msg += string.Format("\n**USD Value:** ${0:N15}", currencies[token.tokenSymbol].quote.USD.price * balance); } msg += "\n**Date:** " + SteamAccounts.UnixTimeStampToDateTime(double.Parse(token.timeStamp)); msg += "\n**Confirmations:** " + string.Format("{0:N0}", ulong.Parse(token.confirmations)); if (count > 8) { msg += "|"; count = 0; } count++; num++; } string[] split = msg.Split('|'); for (int i = 0; i < split.Length; i++) { await PrintEmbedMessage("ETH Tokens", split[i]); } //await Context.Channel.SendMessageAsync(msg); }