public async Task DoTipAsync([Remainder] string Remainder = null) { try { await Context.Message.DeleteAsync(); } catch { } if (Operators.ContainsKey(Context.Message.Author.Id)) { if (RainBorg.IsTipBotOnline()) { RainBorg.waitTime = 0; try { RainBorg.Log(2, "Command", "Manual tip called by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } else { RainBorg.Log(2, "Command", "Manual tip called by {0}, but it failed because tip bot is not online", Context.User.Username); } } }
public async Task ResetAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (KeyValuePair <ulong, LimitedList <ulong> > Entry in RainBorg.UserPools) { Entry.Value.Clear(); } RainBorg.Greylist.Clear(); await Context.Message.Author.SendMessageAsync("User pools and greylist cleared."); try { RainBorg.Log(2, "Command", "All tip pools reset by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task DoMegaTipAsync(decimal Amount, [Remainder] string Remainder = null) { try { await Context.Message.DeleteAsync(); } catch { } if (Operators.ContainsKey(Context.Message.Author.Id)) { if (RainBorg.IsTipBotOnline()) { await RainBorg.MegaTipAsync(Amount); try { RainBorg.Log(2, "Command", "Megatip for {0} {1} called by {2}", RainBorg.Format(Amount), RainBorg.currencyName, Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } else { RainBorg.Log(2, "Command", "Megatip for {0} {1} called by {2}, but it failed because tip bot is not online", RainBorg.Format(Amount), RainBorg.currencyName, Context.User.Username); } } }
public async Task RemoveUserAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (SocketUser user in Context.Message.MentionedUsers) { try { if (RainBorg.UserPools.ContainsKey(Context.Channel.Id) && RainBorg.UserPools[Context.Channel.Id].Contains(user.Id)) { RainBorg.UserPools[Context.Channel.Id].Remove(user.Id); RainBorg.Log(2, "Command", "{0} removed from tip pool on channel {1} ({2}) by {3}", user.Id, Context.Channel.Name, Context.Channel.Id, Context.User.Username); } } catch { } } try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task ExileAsync(ulong user, [Remainder] string Remainder = "") { if (Operators.ContainsKey(Context.Message.Author.Id)) { try { if (!Blacklist.ContainsKey(Context.Client.GetUser(user).Id)) { Blacklist.Add(Context.Client.GetUser(user).Id, Remainder); await RainBorg.RemoveUserAsync(Context.Client.GetUser(user), 0); } } catch { } await Config.Save(); await ReplyAsync("Blacklisted users, they will receive no tips."); try { RainBorg.Log(2, "Command", "{0} was blacklisted by {1} with reason being: {2}", user, Context.User.Username, Remainder); IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task InfoAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { RainBorg.tipBalance = RainBorg.GetBalance(); decimal i = RainBorg.tipMin + RainBorg.tipFee - RainBorg.tipBalance; if (i < 0) { i = 0; } string m = "```Current tip balance: " + RainBorg.Format(RainBorg.tipBalance) + " " + RainBorg.currencyName + "\n" + "Amount needed for next tip: " + RainBorg.Format(i) + " " + RainBorg.currencyName + "\n" + "Next tip at: " + RainBorg.waitNext + "\n" + "Tip minimum: " + RainBorg.Format(RainBorg.tipMin) + " " + RainBorg.currencyName + "\n" + "Tip maximum: " + RainBorg.Format(RainBorg.tipMax) + " " + RainBorg.currencyName + "\n" + "Megatip amount: " + RainBorg.Format(RainBorg.megaTipAmount) + " " + RainBorg.currencyName + "\n" + "Megatip chance: " + RainBorg.Format(RainBorg.megaTipChance) + "%\n" + "Minimum users: " + RainBorg.userMin + "\n" + "Maximum users: " + RainBorg.userMax + "\n" + "Minimum wait time: " + String.Format("{0:n0}", RainBorg.waitMin) + "s (" + TimeSpan.FromSeconds(RainBorg.waitMin).ToString() + ")\n" + "Maximum wait time: " + String.Format("{0:n0}", RainBorg.waitMax) + "s (" + TimeSpan.FromSeconds(RainBorg.waitMax).ToString() + ")\n" + "Message timeout: " + String.Format("{0:n0}", RainBorg.timeoutPeriod) + "s (" + TimeSpan.FromSeconds(RainBorg.timeoutPeriod).ToString() + ")\n" + "Minimum account age: " + TimeSpan.FromHours(RainBorg.accountAge).ToString() + "\n" + "Flush pools on tip: " + RainBorg.flushPools + "\n" + "Operators: " + Operators.Count + "\n" + "Blacklisted: " + Blacklist.Count + "\n" + "Greylisted: " + RainBorg.Greylist.Count + "\n" + "Channels: " + RainBorg.UserPools.Keys.Count + "\n" + "Paused: " + RainBorg.Paused.ToString() + "```"; await Context.Message.Author.SendMessageAsync(m); } }
public async Task ExileAsync(ulong user, [Remainder] string Remainder = "") { if (RainBorg.Operators.Contains(Context.Message.Author.Id)) { try { if (!RainBorg.Blacklist.ContainsKey(Context.Client.GetUser(user).Id)) { RainBorg.Blacklist.Add(Context.Client.GetUser(user).Id, Remainder); await RainBorg.RemoveUserAsync(Context.Client.GetUser(user), 0); } } catch { } await Config.Save(); await ReplyAsync("Blacklisted users, they will receive no tips."); try { IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task RemoveStatusChannelAsync(params ulong[] Channels) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (ulong Channel in Channels) { try { if (RainBorg.StatusChannel.Contains(Channel)) { RainBorg.StatusChannel.Remove(Channel); } } catch { } } await Config.Save(); try { RainBorg.Log("Command", "Status channel removed by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task WarnAsync([Remainder] string Remainder = null) { if (RainBorg.Operators.Contains(Context.Message.Author.Id)) { foreach (SocketUser user in Context.Message.MentionedUsers) { if (user != null && !RainBorg.Greylist.Contains(user.Id)) { EmbedBuilder builder = new EmbedBuilder(); builder.WithColor(Color.Green); builder.WithTitle("SPAM WARNING"); builder.Description = RainBorg.spamWarning; RainBorg.Greylist.Add(user.Id); await RainBorg.RemoveUserAsync(user, 0); await user.SendMessageAsync("", false, builder); } } try { IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task WarnAsync(params ulong[] users) { if (RainBorg.Operators.Contains(Context.Message.Author.Id)) { foreach (ulong user in users) { try { if (Context.Client.GetUser(user) != null && !RainBorg.Greylist.Contains(user)) { EmbedBuilder builder = new EmbedBuilder(); builder.WithColor(Color.Green); builder.WithTitle("SPAM WARNING"); builder.Description = RainBorg.spamWarning; RainBorg.Greylist.Add(user); await RainBorg.RemoveUserAsync(Context.Client.GetUser(user), 0); await Context.Client.GetUser(user).SendMessageAsync("", false, builder); } } catch { } } try { IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task RemoveOperatorAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (SocketUser user in Context.Message.MentionedUsers) { if (Operators.ContainsKey(user.Id)) { Operators.Remove(user.Id); RainBorg.Log("Command", "{0} removed as an operator by {1}", user.Id, Context.User.Username); } } await Config.Save(); try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task RemoveChannelAsync(params ulong[] Ids) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (ulong Id in Ids) { try { if (RainBorg.UserPools.ContainsKey(Id)) { RainBorg.UserPools.Remove(Id); RainBorg.ChannelWeight.RemoveAll(ChannelId => ChannelId == Id); } } catch { } } await Config.Save(); try { RainBorg.Log("Command", "Channels removed by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task UnExileAsync(ulong user) { if (Operators.ContainsKey(Context.Message.Author.Id)) { try { if (Blacklist.ContainsKey(Context.Client.GetUser(user).Id)) { Blacklist.Remove(Context.Client.GetUser(user).Id); } } catch { } await Config.Save(); await ReplyAsync("Removed users from blacklist, they may receive tips again."); try { RainBorg.Log(2, "Command", "{0} was removed from the blacklist by {1}", user, Context.User.Username); IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task AddUserAsync(params ulong[] users) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (ulong user in users) { try { if (RainBorg.UserPools.ContainsKey(Context.Channel.Id) && !RainBorg.UserPools[Context.Channel.Id].Contains(user)) { RainBorg.UserPools[Context.Channel.Id].Add(user, RainBorg.timeoutPeriod); RainBorg.Log(2, "Command", "{0} added to tip pool on channel {1} ({2}) by {3}", user, Context.Channel.Name, Context.Channel.Id, Context.User.Username); } } catch { } } try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task RemoveOperatorAsync(params ulong[] users) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (ulong user in users) { try { if (Operators.ContainsKey(Context.Client.GetUser(user).Id)) { Operators.Remove(Context.Client.GetUser(user).Id); RainBorg.Log("Command", "{0} removed as an operator by {1}", user, Context.User.Username); } } catch { } } await Config.Save(); try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task RemoveStatusChannelMentionAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { foreach (SocketChannel Channel in Context.Message.MentionedChannels) { if (RainBorg.StatusChannel.Contains(Channel.Id)) { RainBorg.StatusChannel.Remove(Channel.Id); } } await Config.Save(); try { RainBorg.Log("Command", "Status channel removed by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task OutOutAsync([Remainder] string Remainder = null) { if (!OptedOut.ContainsKey(Context.Message.Author.Id)) { OptedOut.Add(Context.Message.Author.Id); await RainBorg.RemoveUserAsync(Context.Message.Author, 0); await Config.Save(); try { // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } await Context.Message.Author.SendMessageAsync("You have opted out from receiving future tips."); } else { await Context.Message.Author.SendMessageAsync("You have already opted out, use $optin to opt back into receiving tips."); } }
public void RestartAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { RainBorg.Log(2, "Command", "Restarted by {0}", Context.User.Username); RainBorg.Relaunch(); } }
public Task ExitAsync([Remainder] string Remainder = null) { if (RainBorg.Operators.Contains(Context.Message.Author.Id)) { RainBorg.ConsoleEventCallback(2); Environment.Exit(0); } return(Task.CompletedTask); }
public Task ExitAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { RainBorg.Log(2, "Command", "Exited by {0}", Context.User.Username); RainBorg.ConsoleEventCallback(2); Environment.Exit(0); } return(Task.CompletedTask); }
public async Task BalanceAsync([Remainder] string Remainder = null) { // Get balance RainBorg.tipBalance = RainBorg.GetBalance(); decimal i = RainBorg.tipMin - RainBorg.tipBalance; if (i < 0) { i = 0; } string m = "Current tip balance: " + RainBorg.Format(RainBorg.tipBalance) + RainBorg.currencyName; await ReplyAsync(m); }
public void RestartAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { RainBorg.Log("Command", "Restarted by {0}", Context.User.Username); RainBorg.Log("RainBorg", "Relaunching bot..."); RainBorg.Paused = true; JObject Resuming = new JObject { ["userPools"] = JToken.FromObject(RainBorg.UserPools), ["greylist"] = JToken.FromObject(RainBorg.Greylist), ["userMessages"] = JToken.FromObject(RainBorg.UserMessages) }; File.WriteAllText(RainBorg.resumeFile, Resuming.ToString()); Process.Start("RelaunchUtility.exe", "RainBorg.exe"); RainBorg.ConsoleEventCallback(2); Environment.Exit(0); } }
public async Task ResumeAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { RainBorg.Paused = false; await Context.Message.Author.SendMessageAsync("Bot resumed."); try { RainBorg.Log(2, "Command", "Resumed by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task DoTipAsync([Remainder] string Remainder = null) { try { await Context.Message.DeleteAsync(); } catch { } if (Operators.ContainsKey(Context.Message.Author.Id)) { RainBorg.Waiting = RainBorg.waitTime; try { RainBorg.Log("Command", "Manual tip called by {0}", Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } }
public async Task StatsAsync([Remainder] ulong Id = 0) { if (Operators.ContainsKey(Context.Message.Author.Id)) { string m = "```"; StatTracker Stat = null; Console.WriteLine(Id); // Channel stats if ((Stat = Stats.GetChannelStats(Id)) != null) { m += "#" + Context.Client.GetChannel(Id) + " Channel Stats:\n"; m += "Total " + RainBorg.currencyName + " Sent: " + RainBorg.Format(Stat.TotalAmount) + " " + RainBorg.currencyName + "\n"; m += "Total Tips Sent: " + Stat.TotalTips + "\n"; m += "Average Tip: " + RainBorg.Format(Stat.TotalAmount / Stat.TotalTips) + " " + RainBorg.currencyName + ""; } // User stats else if ((Stat = Stats.GetUserStats(Id)) != null) { m += "@" + Context.Client.GetUser(Id).Username + " User Stats:\n"; m += "Total " + RainBorg.currencyName + " Sent: " + RainBorg.Format(Stat.TotalAmount) + " " + RainBorg.currencyName + "\n"; m += "Total Tips Sent: " + Stat.TotalTips + "\n"; m += "Average Tip: " + RainBorg.Format(Stat.TotalAmount / Stat.TotalTips) + " " + RainBorg.currencyName + ""; } // Global stats else { Stat = Stats.GetGlobalStats(); m += "Global Stats:\n"; m += "Total " + RainBorg.currencyName + " Sent: " + RainBorg.Format(Stat.TotalAmount) + " " + RainBorg.currencyName + "\n"; m += "Total Tips Sent: " + Stat.TotalTips + "\n"; m += "Average Tip: " + RainBorg.Format(Stat.TotalAmount / Stat.TotalTips) + " " + RainBorg.currencyName + ""; } m += "```"; await Context.Message.Author.SendMessageAsync(m); } }
public async Task AddChannelMentionAsync(SocketChannel Channel, int Weight, [Remainder] string Remainder = null) { if (Operators.ContainsKey(Context.Message.Author.Id)) { try { if (!RainBorg.UserPools.ContainsKey(Channel.Id) && Weight > 0) { RainBorg.UserPools.Add(Channel.Id, new List <ulong>()); for (int i = 0; i < Weight; i++) { RainBorg.ChannelWeight.Add(Channel.Id); } await Config.Save(); if (RainBorg.entranceMessage != "") { await(Context.Client.GetChannel(Channel.Id) as SocketTextChannel).SendMessageAsync(RainBorg.entranceMessage); } try { RainBorg.Log("Command", "{0} added to channel list with a weight of {1} by {2}", Channel.Id, Weight, Context.User.Username); // Add reaction to message IEmote emote = Context.Guild.Emotes.First(e => e.Name == RainBorg.successReact); await Context.Message.AddReactionAsync(emote); } catch { await Context.Message.AddReactionAsync(new Emoji("👌")); } } } catch { } } }