public async Task wCmd() { string username = Context.User.ToString(); if (RexTimers.canRunCmd(username, "w")) { int addchances = 0; if (DataUtils.waddchances.ContainsKey(username)) { addchances = DataUtils.waddchances[username]; } bool www = MasterUtils.roll(17 + addchances); string res = "`" + MasterUtils.stripName(username) + " had a (17+" + addchances + ") = " + (17 + addchances) + "% chance, but failed miserably`"; res += "\n`No W's for you today " + MasterUtils.stripName(Context.User.ToString()) + "!`"; if (!www) { await Context.Channel.SendMessageAsync(res); } else { await Context.Channel.SendMessageAsync(MasterUtils.getAnnoyingTTSString(), true); } RexTimers.resetTimer(username, "w"); } else { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "w") + "`"); } }
public async Task emailCmd(string recipient, [Remainder] string emailcontents) { string sentBy = Context.User.ToString(); //check Cooldown if (!RexTimers.canRunCmd(sentBy, "email")) { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(sentBy, "email") + "`"); return; } if (AliasUtils.getAliasKey(recipient).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user!"); } recipient = DataUtils.aliases[AliasUtils.getAliasKey(recipient)]; DataUtils.sendEmail(sentBy, recipient, emailcontents); var messages = await Context.Channel.GetMessagesAsync(((int)1)).Flatten(); await Context.Channel.DeleteMessagesAsync(messages); await Context.Channel.SendMessageAsync("`" + sentBy + " successfully sent an email to " + recipient + "`"); RexTimers.resetTimer(sentBy, "email"); }
public async Task reportCmd([Remainder] string name) { string username = Context.User.ToString(); if (RexTimers.canRunCmd(username, "report") || MasterUtils.ContainsAny(username, GlobalVars.ADMINS)) { if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("You're trying to report an unregistered user!"); } else { name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; DataUtils.incReports(name); await Context.Channel.SendMessageAsync("Report successful"); RexTimers.resetTimer(username, "report"); } } else { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "report") + "`"); } }
public static void writeStatsToTxt() { if (System.IO.File.Exists(DataUtils.textPath + "stats.txt")) { try { System.IO.File.Delete(DataUtils.textPath + "stats.txt"); } catch (System.IO.IOException e) { Console.WriteLine(e.Message); return; } } using (StreamWriter sw = File.AppendText(DataUtils.textPath + "stats.txt")) { int tmp = GlobalVars.STATS_SHOW; GlobalVars.STATS_SHOW = wordUsageDict.Count; sw.WriteLine(DateTime.Now.ToString()); sw.WriteLine("Total Uptime : " + RexTimers.getTime(RexTimers.systemRunClock)); sw.WriteLine("Total unique word count : " + wordUsageDict.Keys.Count); sw.WriteLine("Total Message Count : " + MessagesRecieved); sw.WriteLine("--- Words ---\n"); sw.WriteLine(getTop3Words()); sw.WriteLine("--- End ---"); GlobalVars.STATS_SHOW = tmp; } }
public async Task forgiveCmd([Remainder] string name) { string username = Context.User.ToString(); if (RexTimers.canRunCmd(username, "forgive") || MasterUtils.ContainsAny(username, GlobalVars.ADMINS)) { if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("You're trying to forgive an unregistered user!"); } else { name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; if (name == username) { await Context.Channel.SendMessageAsync("Are you seriously trying to forgive yourself bruh?"); RexTimers.resetTimer(username, "forgive"); return; } if (DataUtils.reports.ContainsKey(name)) { if (DataUtils.reports[name] <= 0) { await Context.Channel.SendMessageAsync("You can't forgive someone with 0 or less reports"); } else { DataUtils.gainReports(name, -1); await Context.Channel.SendMessageAsync("You successfully forgave this fool"); } } else { await Context.Channel.SendMessageAsync("This angel has not been reported yet"); } RexTimers.resetTimer(username, "forgive"); } } else { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "forgive") + "`"); } }
public async Task eminemCmd() { string username = Context.User.ToString(); if (RexTimers.canRunCmd(username, "eminem")) { await Context.Channel.SendFileAsync(picPath + "eminem.jpg"); await Context.Channel.SendMessageAsync("PALMS SPAGHETTI KNEAS WEAK ARM SPAGHETTI THERES SPAGHETTI ON HIS SPAGHETTI ALREADY, MOMS SPAGHETTI", true); RexTimers.resetTimer(username, "eminem"); } else { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "eminem") + "`"); } }
public async Task giftCmd() { string username = Context.User.ToString(); //check Cooldown if (!RexTimers.canRunCmd(username, "gift")) { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "gift") + "`"); return; } int gift = DataUtils.rnd.Next(0, 122); DataUtils.gainReports(username, gift); await Context.Channel.SendMessageAsync("Your gift: " + gift + " reports!\n" + "Come back to me after 10000 seconds"); RexTimers.resetTimer(username, "gift"); }
public async Task obegCmd() { string username = Context.User.ToString(); if (!DataUtils.reports.ContainsKey(username)) { await Context.Channel.SendMessageAsync("Not reported yet"); return; } if (RexTimers.canRunCmd(username, "beg"))//|| MasterUtils.ContainsAny(username, GlobalVars.ADMINS) { double dice = DataUtils.rnd.Next(1, 101); string punishment = ""; int oldReportCount = DataUtils.reports[username]; int newReportCount = oldReportCount; if (dice < 21) { newReportCount = oldReportCount + 5; punishment = "You don't deserve anything good"; } else if (dice < 41) { newReportCount = oldReportCount - 7; punishment = "I'm feeling generous"; } else if (dice < 51) { newReportCount = oldReportCount + 10; punishment = "Haha middle finger up your bum"; } else if (dice < 61) { newReportCount = oldReportCount - 13; punishment = "You better start to like me"; } else if (dice < 71) { newReportCount = oldReportCount + 20; punishment = "gfi idiot"; } else if (dice < 81) { newReportCount = oldReportCount - 25; punishment = "you lucky bastard"; } else if (dice < 86) { newReportCount = oldReportCount + 35; punishment = "hahaha u failed so hard"; } else if (dice < 91) { newReportCount = oldReportCount - 42; punishment = "That's a lot of reports gone you lucky mf"; } else if (dice < 94) { newReportCount = oldReportCount * 2; punishment = "HAHA in yo face idiot"; } else if (dice < 97) { newReportCount = oldReportCount / 2; punishment = "its your lucky day m8"; } else if (dice < 99) { newReportCount = oldReportCount + 3; punishment = "Woops"; } else if (dice == 99) { newReportCount = 0; punishment = "You're a zero not a hero"; } else { newReportCount = oldReportCount * 5; punishment = "YOU JUST HIT THE REPORT JACKPOT"; } if (newReportCount > GlobalVars.MAX_REPORTS) { newReportCount = 0; DataUtils.gainCoins(username, GlobalVars.MAX_REPORTS); await Context.Channel.SendMessageAsync("Gratz! You went above the report cap. Auto exchanged reports to coins!", true); punishment += "\nGratz! You went above the report cap. Auto exchanged reports to coins!"; } if (newReportCount < 0) { newReportCount = 0; punishment += "\nBtw your report count went below 0 so I set it to 0"; } punishment += "\n\n**Report count : " + oldReportCount + " -> " + newReportCount + "**"; DataUtils.setReports(username, newReportCount); EmbedBuilder emb = new EmbedBuilder(); emb.Color = new Color(255, 0, 255); emb.Title = "**Old Beg Info**\n"; string desc = "1-20 : +5 reports\n"; desc += "21-40 : -7 reports\n"; desc += "41-50 : +10 reports\n"; desc += "51-60 : -13 reports\n"; desc += "61-70 : +20 reports\n"; desc += "71-80 : -25 reports\n"; desc += "81-85 : +35 reports\n"; desc += "86-90 : -42 reports\n"; desc += "91-93 : double reports\n"; desc += "94-96 : half reports\n"; desc += "97-98 : triple reports\n"; desc += "99 : set report count to 0\n"; desc += "100 : Quintuple report count\n\n"; desc += "**You rolled : " + dice.ToString() + "**"; desc += "\n\n**Bot Comment**\n"; desc += punishment; emb.Description = desc; await Context.Channel.SendMessageAsync("", false, emb); RexTimers.resetTimer(username, "beg"); } else { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "beg") + "`"); } }
public async Task buyCmd([Remainder] string query) { string username = Context.User.ToString(); //check Cooldown if (!RexTimers.canRunCmd(username, "buy")) { await Context.Channel.SendMessageAsync("`" + RexTimers.getWaitMsg(username, "buy") + "`"); return; } // DataUtils.coins[username] = 1000; //test purposes //Check query argument count validity string[] words = query.Split(' '); //this condition will never be met.. as fun;ction will not be called (will call !help !buy) if (words.Length < 1) { await Context.Channel.SendMessageAsync("Specify what you want to buy"); return; } int index = DataUtils.shop.FindIndex(f => f.Callname == words[0]); if (index < 0) { await Context.Channel.SendMessageAsync("You entered an invalid item"); return; } ShopItem item = DataUtils.shop.ElementAt(index); if (item.Argcount != words.Length) { await Context.Channel.SendMessageAsync("Check your arguments bruh"); return; } //Check if we have enough coins to buy item int cost = item.Cost; if (!DataUtils.canBuy(username, cost)) { await Context.Channel.SendMessageAsync("You dont have enough money you poor thing"); return; } //Actually buy the item DataUtils.spendCoins(username, cost); string name; int dice; switch (item.Callname) { case "report": //check if valid user -> name = words[1]; if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user!"); } name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; dice = DataUtils.rnd.Next(1, 101); if (dice < 50) { DataUtils.gainReports(name, 77); await Context.Channel.SendMessageAsync(name + "has been reported 77 times LOL!"); } else { await Context.Channel.SendMessageAsync("I decided not to report anyone"); } break; case "forgive": //check if valid user -> name = words[1]; if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user!"); } name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; dice = DataUtils.rnd.Next(1, 101); if (dice < 50) { DataUtils.gainReports(name, -77); await Context.Channel.SendMessageAsync(name + "has been forgiven 77 times!"); } else { await Context.Channel.SendMessageAsync("I decided not to forgive anyone"); } break; case "w": await Context.Channel.SendMessageAsync(MasterUtils.getAnnoyingTTSString(), true); break; case "wchance": DataUtils.incWAddChances(username); await Context.Channel.SendMessageAsync("Successfully increased your !w chances by 1%"); break; //case "beg": //break; case "catmode": //length of temp catmode in MasterHandler RexTimers.catModeClock.Start(); break; case "restrain": name = words[1]; if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user!"); } name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; int timeInSeconds = DataUtils.rnd.Next(121, 181); AdminUtils.addRestriction(name, timeInSeconds); await Context.Channel.SendMessageAsync(name + " is restrained for " + timeInSeconds + "s!"); break; case "purge": if (int.Parse(words[1]) > 30) { await Context.Channel.SendMessageAsync("You tried to purge too many messages! What a waste of coins..."); } var messages = await Context.Channel.GetMessagesAsync((int.Parse(words[1]) + 1)).Flatten(); await Context.Channel.DeleteMessagesAsync(messages); break; case "tts": name = words[1]; if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user! What a waste of coins..."); } name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; RexTimers.addPersonToTTS(name); await Context.Channel.SendMessageAsync("```" + username + " decided to tts-annoy " + name + "!\n" + name + " better start sending messages for the next 3 minutes or i'm going to take all of your coins!```"); break; case "annoy": name = words[1]; if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user! What a waste of coins..."); } name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; RexTimers.addPersonToAnnoy(name); await Context.Channel.SendMessageAsync("```" + username + " decided to super annoy " + name + "!\n" + name + " better start sending messages for the next 3 minutes or i'm going to take all of your coins!```"); break; case "confuse": name = words[1]; if (AliasUtils.getAliasKey(name).Contains("None")) { await Context.Channel.SendMessageAsync("Invalid user! What a waste of coins..."); } name = DataUtils.aliases[AliasUtils.getAliasKey(name)]; RexTimers.addPersonToConfuse(name); await Context.Channel.SendMessageAsync("```" + username + " decided to confuse " + name + "!\n" + name + " better start sending messages for the next 3 minutes or i'm going to take all of your coins!```"); break; case "bribe": await Context.Channel.SendMessageAsync("This function is not implemented yet! What a waste of coins..."); break; default: await Context.Channel.SendMessageAsync("Item not added to switch statement"); break; } //show coins spent and coins remaining await Context.Channel.SendMessageAsync("`" + username + " paid " + cost + "coins and has " + DataUtils.getCoinCount(username) + " left!`"); RexTimers.resetTimer(username, "buy"); //Check if valid argument types..? -> Just force convert.. //await Context.Channel.SendMessageAsync("Your requested item is at index :" + index + " which costs " + DataUtils.shop.ElementAt(index).Cost); }
public async Task cdCmd() { await Context.Channel.SendMessageAsync(RexTimers.getCds(Context.User.ToString())); }
public async Task statusCmd() { DateTime dateTime = new DateTime(2017, 5, 13); EmbedBuilder emb = new EmbedBuilder(); emb.Color = new Color(196, 09, 155); emb.ThumbnailUrl = "http://silhouettesfree.com/machines/robots/robot-silhouette-image.png"; emb.Title = "**🤜 RexBot 2.0 by Rexyrex 🤛**\n"; //try //{ // string joke = await WebUtils.getOneLiner(); // emb.Description = "\"" + joke + "\""; //} catch(Exception e) //{ // Console.WriteLine(e.ToString()); //} emb.Description = "**➺Github** : [RexBot 2.0](https://github.com/rexyrex/RexBot-2.0 \"ALL\")\n" + "**➺Geoff DB** : [Google Docs](https://docs.google.com/spreadsheets/d/1EeJpyo7Rvh-WxcYoKB2qHzBR3L_0xvR9fW1COqGhljI/edit#gid=2091390326 \"ABOARD\")\n" + "**➺Support Rexyrex** : [Newgrounds](http://rexyrex.newgrounds.com/audio/ \"THE FEED TRAIN\")" + ", [Youtube](https://www.youtube.com/channel/UCq3yY-SCoglG8xm6Z1_udaw \"CHOO CHOO\")"; EmbedFieldBuilder modeField = new EmbedFieldBuilder(); modeField.Name = "Mode"; modeField.Value = DataUtils.mode; modeField.IsInline = true; EmbedFieldBuilder ageField = new EmbedFieldBuilder(); ageField.Name = "Age"; ageField.Value = Math.Round((DateTime.Now - dateTime).TotalDays, 2) + " days"; ageField.IsInline = true; EmbedFieldBuilder upTimeField = new EmbedFieldBuilder(); upTimeField.Name = "UpTime"; upTimeField.Value = RexTimers.getTime(RexTimers.systemRunClock); upTimeField.IsInline = true; string cmdCountStr = StatsUtils.getCommandCount(_commandService).ToString(); EmbedFieldBuilder cmdCountField = new EmbedFieldBuilder(); cmdCountField.Name = "Commands"; cmdCountField.Value = cmdCountStr; cmdCountField.IsInline = true; EmbedFieldBuilder userCountField = new EmbedFieldBuilder(); userCountField.Name = "Users"; userCountField.Value = StatsUtils.UserCount; userCountField.IsInline = true; EmbedFieldBuilder statusField = new EmbedFieldBuilder(); statusField.Name = "Status"; statusField.Value = "YOLO"; statusField.IsInline = true; EmbedFieldBuilder efb6 = new EmbedFieldBuilder(); efb6.Name = "❤️ Special Thanks To ❤️"; efb6.Value = "Geoff - DB & testing\nEm - Utils & testing\nJamie - !calc\nNick - W W W W & testing"; efb6.IsInline = false; emb.AddField(modeField); emb.AddField(cmdCountField); emb.AddField(ageField); emb.AddField(upTimeField); emb.AddField(userCountField); emb.AddField(statusField); emb.AddField(efb6); await Context.Channel.SendMessageAsync("", false, emb); }
public async Task statsCmd() { DateTime dateTime = new DateTime(2017, 5, 13); EmbedBuilder emb = new EmbedBuilder(); emb.Color = new Color(0, 255, 0); //emb.ThumbnailUrl = "http://pngimages.net/sites/default/files/bar-chart-png-image-892.png"; emb.Timestamp = new DateTimeOffset(DateTime.Now); emb.Title = "**📈 Statistics 📉**\n"; //emb.Url = "https://www.youtube.com/watch?v=4YpTLy6dn5c"; emb.Description = "[Displaying the stats of this session!](https://en.wikipedia.org/wiki/Statistics \"I hate ryan\")\n\n" + "**UpTime** : " + RexTimers.getTime(RexTimers.systemRunClock) + "\n\n" + "**Commands Run** : " + StatsUtils.CommandsRun + "\n" + "**Commands Per Minute** : " + Math.Round((double)(StatsUtils.CommandsRun / RexTimers.systemRunClock.Elapsed.TotalMinutes), 5) + "\n\n" + "**Reactions** : " + StatsUtils.ReactionCount + "\n" + "**Reactions Per Minute** : " + Math.Round((double)(StatsUtils.ReactionCount / RexTimers.systemRunClock.Elapsed.TotalMinutes), 5) + "\n\n" + "**Messages Received** : " + StatsUtils.MessagesRecieved + "\n" + "**Messages Edited** : " + StatsUtils.MsgEditCount + "\n" + "**Messages Deleted** : " + StatsUtils.MsgDeleteCount + "\n\n" + "**Unique words** : " + StatsUtils.wordUsageDict.Keys.Count + "\n\n" + "__🥇Leaderboards🥇__"; EmbedFieldBuilder topReportsField = new EmbedFieldBuilder(); topReportsField.Name = "Reported"; topReportsField.Value = DataUtils.getReportTopList(); topReportsField.IsInline = true; EmbedFieldBuilder topWField = new EmbedFieldBuilder(); topWField.Name = "!W LEVEL"; topWField.Value = DataUtils.getWaddChancesTopList(); topWField.IsInline = true; EmbedFieldBuilder mostUsedCommandsField = new EmbedFieldBuilder(); mostUsedCommandsField.Name = "Commands"; mostUsedCommandsField.Value = StatsUtils.getTop3Commands(); mostUsedCommandsField.IsInline = true; EmbedFieldBuilder mostMsgUserField = new EmbedFieldBuilder(); mostMsgUserField.Name = "Messages"; mostMsgUserField.Value = StatsUtils.getTop3Messagers(); mostMsgUserField.IsInline = true; EmbedFieldBuilder mostMentionedUserField = new EmbedFieldBuilder(); mostMentionedUserField.Name = "Mentioned"; mostMentionedUserField.Value = StatsUtils.getTop3MentionedUsers(); mostMentionedUserField.IsInline = true; EmbedFieldBuilder highestSentScoreField = new EmbedFieldBuilder(); highestSentScoreField.Name = "Likability"; highestSentScoreField.Value = StatsUtils.getTop3SentScoreUser(); highestSentScoreField.IsInline = true; EmbedFieldBuilder mostUsedWordsField = new EmbedFieldBuilder(); mostUsedWordsField.Name = "Most Used Words"; mostUsedWordsField.Value = StatsUtils.getTop3Words(); mostUsedWordsField.IsInline = true; EmbedFieldBuilder leastUsedWordsField = new EmbedFieldBuilder(); leastUsedWordsField.Name = "Least Used Words"; leastUsedWordsField.Value = StatsUtils.getBottom3Words(); leastUsedWordsField.IsInline = true; EmbedFieldBuilder randomWordsField = new EmbedFieldBuilder(); randomWordsField.Name = "Random Sample"; randomWordsField.Value = StatsUtils.getRandomWords(); randomWordsField.IsInline = true; emb.AddField(topReportsField); emb.AddField(topWField); emb.AddField(mostMsgUserField); emb.AddField(mostUsedCommandsField); emb.AddField(mostUsedWordsField); emb.AddField(leastUsedWordsField); emb.AddField(randomWordsField); emb.AddField(mostMentionedUserField); emb.AddField(highestSentScoreField); await Context.Channel.SendMessageAsync("", false, emb); }