public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { if (command.ops == null) { bot.RequestChannelOpListAndQueueFurtherRequest(new UserGeneratedCommand() { channel = channel, terms = terms, rawTerms = rawTerms, ops = null, characterName = characterName, commandName = Name }); } else { Console.WriteLine("Channeloprequest completing"); string[] opsList = command.ops; string output = ""; if (opsList == null) { output = "opslist was null"; } else { output = Utils.PrintList(opsList); output += " " + Utils.GetCharacterUserTags(characterName) + " is an op? " + opsList.Contains(characterName); } bot.SendMessageInChannel("[b][ADMIN] [/b]" + output, channel); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); bool characterIsAdmin = Utils.IsCharacterAdmin(bot.AccountSettings.AdminCharacters, characterName); if (thisChannel.ChipsClearance == ChipsClearanceLevel.ChannelOp && command.ops == null) { bot.RequestChannelOpListAndQueueFurtherRequest(command); } else if ((thisChannel.ChipsClearance == ChipsClearanceLevel.DicebotAdmin && !characterIsAdmin) || (thisChannel.ChipsClearance == ChipsClearanceLevel.ChannelOp && !command.ops.Contains(characterName) && !characterIsAdmin)) { bot.SendMessageInChannel(Utils.GetCharacterUserTags(characterName) + " cannot perform [" + Name + "] under the current chip settings for this channel.", channel); } else if (thisChannel.AllowChips) { string messageString = bot.DiceBot.RemoveChipsPile(characterName, channel); commandController.SaveChipsToDisk(); bot.SendMessageInChannel(messageString, channel); } else { bot.SendMessageInChannel(Name + " is currently not allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", channel); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); bool characterIsAdmin = Utils.IsCharacterAdmin(bot.AccountSettings.AdminCharacters, characterName); if (thisChannel.ChipsClearance == ChipsClearanceLevel.ChannelOp && command.ops == null) { bot.RequestChannelOpListAndQueueFurtherRequest(command); } else if ((thisChannel.ChipsClearance == ChipsClearanceLevel.DicebotAdmin && !characterIsAdmin) || (thisChannel.ChipsClearance == ChipsClearanceLevel.ChannelOp && !command.ops.Contains(characterName) && !characterIsAdmin)) { bot.SendMessageInChannel(Utils.GetCharacterUserTags(characterName) + " cannot perform [" + Name + "] under the current chip settings for this channel.", channel); } else if (thisChannel.AllowChips) { string messageString = ""; if (terms.Length < 2) { messageString = "Error: This command requires a number (first) and a user name (second)."; } else { bool all = false; int giveAmount = Utils.GetNumberFromInputs(terms); string[] rawTermsMost = new string[rawTerms.Length - 1]; for (int i = 1; i < rawTerms.Length; i++) { rawTermsMost[i - 1] = rawTerms[i]; } string targetUserName = Utils.GetFullStringOfInputs(rawTermsMost).Trim(); if (giveAmount <= 0 && !all) { messageString = "Error: You must input a number to take an amount of chips."; } else { messageString = bot.DiceBot.TakeChips(characterName, targetUserName, channel, giveAmount, all); commandController.SaveChipsToDisk(); } } bot.SendMessageInChannel(messageString, channel); } else { bot.SendMessageInChannel(Name + " is currently not allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", channel); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); bool characterIsAdmin = Utils.IsCharacterAdmin(bot.AccountSettings.AdminCharacters, characterName); bool characterIsTrustedForChannel = Utils.IsCharacterTrusted(bot.AccountSettings.TrustedCharacters, characterName, channel); if (thisChannel.ChipsClearance == ChipsClearanceLevel.ChannelOp && command.ops == null) { bot.RequestChannelOpListAndQueueFurtherRequest(command); } else if ((thisChannel.ChipsClearance == ChipsClearanceLevel.DicebotAdmin && !characterIsAdmin && !characterIsTrustedForChannel) || (thisChannel.ChipsClearance == ChipsClearanceLevel.ChannelOp && !command.ops.Contains(characterName) && !characterIsAdmin)) { bot.SendMessageInChannel(Utils.GetCharacterUserTags(characterName) + " cannot perform [" + Name + "] under the current chip settings for this channel.", channel); } else if (thisChannel.AllowChips) { bool pot = false; int chipAmount = Utils.GetNumberFromInputs(terms); if (terms != null && terms.Length >= 1 && terms.Contains("pot")) { pot = true; } string messageString = ""; if (chipAmount <= 0) { messageString = "Error: You must specify a number of chips above 0 to add."; } else { messageString = bot.DiceBot.AddChips(characterName, channel, chipAmount, pot); commandController.SaveChipsToDisk(); } bot.SendMessageInChannel(messageString, channel); } else { bot.SendMessageInChannel(Name + " is currently not allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", channel); } }