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 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 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 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 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 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 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 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 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 WarnAsync([Remainder] string Remainder = null) { if (Operators.ContainsKey(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); RainBorg.Log(2, "Command", "{0} was sent a spam warning by {1}", user.Id, Context.User.Username); 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 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 (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 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 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 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 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 { } } }