public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { if (rawTerms.Length < 2) { bot.SendMessageInChannel("Error: This command requires 2 terms. (Amount and chip code)", channel); } else { int chipAmount = Utils.GetNumberFromInputs(terms); string chipCode = rawTerms[1]; if (chipAmount > 0 && !string.IsNullOrEmpty(chipCode)) { bot.ChipsCoupons.Add(new ChipsCoupon() { ChipsAmount = chipAmount, Code = chipCode }); commandController.SaveCouponsToDisk(); bot.SendMessageInChannel("Added code " + chipCode + " for " + chipAmount + " chips.", channel); } else { bot.SendMessageInChannel("Error on inputs for chips code.", channel); } } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); if (thisChannel.AllowChips) { string messageString = ""; ChipPile existing = bot.DiceBot.GetChipPile(characterName, channel, false); if (existing != null) { messageString = Utils.GetCharacterUserTags(characterName) + " is already registered."; } else { messageString = Utils.GetCharacterUserTags(characterName) + " was registered for a chips pile."; if (thisChannel.StartWith500Chips) { messageString += "\n[b]500 chips[/b] were given to " + Utils.GetCharacterUserTags(characterName) + " to start."; } bot.DiceBot.AddChips(characterName, channel, 0, false); 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); if (thisChannel.AllowTableInfo) { string tableName = commandController.GetTableNameFromCommandTerms(terms); SavedRollTable infoTable = Utils.GetTableFromId(bot.SavedTables, tableName); string sendMessage = "Table \'" + tableName + "\' not found."; if (infoTable != null) { sendMessage = "Table id [b]" + infoTable.TableId + "[/b] created by [user]" + infoTable.OriginCharacter + "[/user]"; if (infoTable.Table != null) { string tabledesc = infoTable.Table.Description + "\n"; sendMessage += "\n\n Name: [b]" + infoTable.Table.Name + "[/b]\n " + tabledesc + " Roll Die: d" + infoTable.Table.DieSides + " Roll Bonus: " + infoTable.Table.RollBonus; sendMessage += "\n" + infoTable.Table.GetTableEntryList(); } else { sendMessage += "\n (Rolltable contents not found)"; } } bot.SendMessageInChannel(sendMessage, 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 = 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); if (thisChannel.AllowChips) { bool half = false; bool third = false; if (terms != null && terms.Length >= 1 && terms.Contains("half")) { half = true; } if (terms != null && terms.Length >= 1 && terms.Contains("third")) { third = true; } string messageString = bot.DiceBot.ClaimPot(characterName, channel, half, third); 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); if (thisChannel.AllowChips) { bool all = false; int betAmount = Utils.GetNumberFromInputs(terms); if (terms != null && terms.Length >= 1 && terms.Contains("all")) { all = true; } string messageString = ""; if (betAmount == 0 && !all) { messageString = "Error: You must input a number or 'all' to make a bet."; } else { messageString = bot.DiceBot.BetChips(characterName, channel, betAmount, 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); if (thisChannel.AllowGames) { string messageString = ""; IGame gametype = commandController.GetGameTypeFromCommandTerms(bot.DiceBot, terms); bool adminCancel = terms.Contains("override"); if (gametype == null) { //check game sessions and see if this channel has a session for anything var gamesPresent = bot.DiceBot.GameSessions.Where(a => a.ChannelId == channel); if (gamesPresent.Count() == 0) { messageString = "Error: No game sessions are active in this channel to cancel."; } else if (gamesPresent.Count() > 1) { messageString = "Error: You must specify a game type if more than one game session exists in the channel."; } else if (gamesPresent.Count() == 1) { GameSession sesh = gamesPresent.First(); gametype = sesh.CurrentGame; } } if (gametype != null) { GameSession sesh = bot.DiceBot.GetGameSession(channel, gametype, false); if (sesh != null) { ChipPile potChips = bot.DiceBot.GetChipPile(DiceBot.PotName, channel); if (!adminCancel && sesh.Ante > 0 && potChips.Chips > 0) { messageString = "The pot already has chips in it. The pot must be empty before cancelling a game with ante."; } else { messageString = bot.DiceBot.CancelGame(channel, gametype); } } else { messageString = "Error: Game session for " + gametype.GetGameName() + " not found or created."; } } 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); if (thisChannel.AllowChips) { bool all = false; bool pot = false; bool secret = false; if (terms != null && terms.Length >= 1 && terms.Contains("all")) { all = true; } if (terms != null && terms.Length >= 1 && terms.Contains("pot")) { pot = true; } if (terms != null && terms.Length >= 1 && terms.Contains("secret")) { secret = true; } string messageString = ""; if (all) { messageString = bot.DiceBot.ListAllChipPiles(channel); } else { if (pot) { messageString = bot.DiceBot.DisplayChipPile(channel, DiceBot.PotName); } else { messageString = bot.DiceBot.DisplayChipPile(channel, characterName); } } if (all || secret) { bot.SendPrivateMessage(messageString, characterName); } else { 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); if (thisChannel.AllowChips) { if (thisChannel.ChipsClearance != ChipsClearanceLevel.DicebotAdmin) { bot.SendMessageInChannel("Redeemchips is only functional in channels that have [b]restricted[/b] chips pools. Please try using '!addchips' instead.", channel); } else { string messageString = ""; if (rawTerms.Count() < 1) { messageString = "Error: This command requires a chips code."; } else { string chipsCode = rawTerms[0]; //find chips coupon ChipsCoupon coupon = bot.ChipsCoupons.FirstOrDefault(a => a.Code == chipsCode); if (coupon == null) { messageString = "chips code not found (" + chipsCode + ")"; } else if (coupon.Redeemed) { messageString = "This chips code (" + chipsCode + ") has already been redeemed."; } else { //mark redeemed and add chips to the redeeming character coupon.Redeemed = true; coupon.RedeemedBy = characterName; messageString = "Chips code redeemed.\n" + bot.DiceBot.AddChips(characterName, channel, coupon.ChipsAmount, false) + "\n[sub]Thank you for purchasing Dice Bot chips![/sub]"; commandController.SaveChipsToDisk(); commandController.SaveCouponsToDisk(); } } 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) { string messageString = "[b][DICE BOT ADMIN MESSAGE]:[/b]" + Utils.GetFullStringOfInputs(rawTerms); bot.SendMessageInChannel("[b][ADMIN] Sending message to all occupied channels: [/b]" + messageString, channel); foreach (string channelCode in bot.ChannelsJoined) { bot.SendMessageInChannel(messageString, channelCode); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { string tableName = commandController.GetTableNameFromCommandTerms(terms); SavedRollTable deleteTable = Utils.GetTableFromId(bot.SavedTables, tableName); string sendMessage = "No tables found for [user]" + characterName + "[/user]"; if (deleteTable != null) { if (characterName == deleteTable.OriginCharacter) { bot.SavedTables.Remove(deleteTable); sendMessage = "[b]" + deleteTable.TableId + "[/b] deleted by [user]" + characterName + "[/user]"; Utils.WriteToFileAsData(bot.SavedTables, Utils.GetTotalFileName(BotMain.FileFolder, BotMain.SavedTablesFileName)); } else { sendMessage = "Only " + deleteTable.OriginCharacter + " can delete their own saved table."; } } bot.SendMessageInChannel(sendMessage, channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { CardCommandOptions options = new CardCommandOptions(commandController, terms, characterName); int numberDrawn = Utils.GetNumberFromInputs(terms); if (numberDrawn > 1) { options.cardsS = "s"; } string customDeckName = Utils.GetCustomDeckName(characterName); string deckTypeString = Utils.GetDeckTypeStringHidePlaying(options.deckType, customDeckName); string cardDrawingCharacterString = Utils.GetCharacterStringFromSpecialName(options.characterDrawName); string trueDraw = ""; string drawOutput = bot.DiceBot.DrawCards(numberDrawn, options.jokers, options.deckDraw, channel, options.deckType, options.characterDrawName, options.secretDraw, out trueDraw); string channelMessageOutput = "[i]" + cardDrawingCharacterString + ": " + deckTypeString + "Card" + options.cardsS + " drawn:[/i] " + drawOutput; if (options.secretDraw && !(options.characterDrawName == DiceBot.DealerName || options.characterDrawName == DiceBot.BurnCardsName || options.characterDrawName == DiceBot.DiscardName)) { string playerMessageOutput = "[i]" + cardDrawingCharacterString + ": " + deckTypeString + "Card" + options.cardsS + " drawn:[/i] " + trueDraw; bot.SendPrivateMessage(playerMessageOutput, characterName); } bot.SendMessageInChannel(channelMessageOutput, channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { int channelsNumber = bot.ChannelsJoined.Count(); TimeSpan onlineTime = DateTime.UtcNow - bot.LoginTime; bot.SendMessageInChannel("Dicebot has been online for " + Utils.GetTimeSpanPrint(onlineTime), channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { string characterDrawName = commandController.GetCharacterDrawNameFromCommandTerms(characterName, terms); DeckType deckType = commandController.GetDeckTypeFromCommandTerms(terms); string customDeckName = Utils.GetCustomDeckName(characterName); string deckTypeString = Utils.GetDeckTypeStringHidePlaying(deckType, customDeckName); Hand h = bot.DiceBot.GetHand(channel, deckType, characterDrawName); string displayName = characterDrawName; if (displayName.Contains(DiceBot.PlaySuffix)) { displayName = displayName.Replace(DiceBot.PlaySuffix, ""); } string outputString = "[i]" + deckTypeString + "Showing [user]" + displayName + "[/user]'s " + h.GetCollectionName() + ": [/i]" + h.ToString(); if (characterDrawName == DiceBot.BurnCardsName) { outputString = "[i]" + deckTypeString + "Showing burned cards: [/i]" + h.ToString(); } else if (characterDrawName == DiceBot.DealerName) { outputString = "[i]" + deckTypeString + "Showing the dealer's hand: [/i]" + h.ToString(); } else if (characterDrawName == DiceBot.DiscardName) { outputString = "[i]" + deckTypeString + "Showing discarded cards: [/i]" + h.ToString(); } bot.SendMessageInChannel(outputString, channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { string customDeckName = Utils.GetCustomDeckName(characterName); SavedDeck deleteDeck = Utils.GetDeckFromId(bot.SavedDecks, customDeckName); string sendMessage = "No decks found for [user]" + characterName + "[/user]"; if (deleteDeck != null) { if (characterName == deleteDeck.OriginCharacter) { bot.SavedDecks.Remove(deleteDeck); sendMessage = "[b]" + deleteDeck.DeckId + "[/b] deleted by [user]" + characterName + "[/user]"; Utils.WriteToFileAsData(bot.SavedDecks, Utils.GetTotalFileName(BotMain.FileFolder, BotMain.SavedDecksFileName)); } else { sendMessage = "Only " + deleteDeck.OriginCharacter + " can delete their own saved deck."; } } bot.SendMessageInChannel(sendMessage, channel); }
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) { string newStatus = Utils.GetFullStringOfInputs(rawTerms); bot.SetStatus(STAStatus.Online, newStatus); bot.SendMessageInChannel("[b][ADMIN] Status updated.[/b]", 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); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); if (thisChannel.AllowGames) { string messageString = ""; if (terms.Length < 1) { messageString = "Error: This command requires a game name."; } else { IGame gametype = commandController.GetGameTypeFromCommandTerms(bot.DiceBot, terms); if (gametype == null) { messageString = "Error: Game type not found."; } else { GameSession sesh = bot.DiceBot.GetGameSession(channel, gametype, false); if (sesh != null) { double secondsRemain = bot.DiceBot.GetSecondsRemainingOnCountdownTimer(channel, gametype.GetGameName()); messageString = sesh.GetStatus(secondsRemain); } else { messageString = "Game session for " + gametype.GetGameName() + " not found or created."; } } } 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); 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(rawTerms); 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 give an amount of chips."; } else { messageString = bot.DiceBot.GiveChips(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) { if (BotMain._debug) { bot.SendMessageInChannel("Command recieved: " + Utils.PrintList(terms), channel); } bool debugOverride = false; string finalResult = bot.DiceBot.GetRollResult(terms, debugOverride); string userName = "******" + Utils.GetCharacterUserTags(characterName) + "[/i]: "; bot.SendMessageInChannel(userName + finalResult, channel); if (BotMain._debug) { Console.WriteLine("Command finished: " + finalResult); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { DeckType deckType = commandController.GetDeckTypeFromCommandTerms(terms); string customDeckString = Utils.GetCustomDeckName(characterName); string deckTypeString = Utils.GetDeckTypeStringHidePlaying(deckType, customDeckString); bot.DiceBot.EndHand(channel, deckType); bot.SendMessageInChannel("[i]" + deckTypeString + "All hands have been emptied.[/i]", channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); if (thisChannel.AllowChips) { string messageString = ""; if (terms.Length < 1) { messageString = "Error: This command requires a number."; } else { bool pot = false; int chipAmount = Utils.GetNumberFromInputs(terms); if (terms != null && terms.Length >= 1 && terms.Contains("pot")) { pot = true; } messageString = ""; if (chipAmount <= 0) { messageString = "Error: You must specify a number of chips above 0 to remove."; } else { messageString = bot.DiceBot.AddChips(characterName, channel, -1 * 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); } }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { int numberCharacters = 0; if (terms.Length > 0) { int.TryParse(terms[0], out numberCharacters); } bot.SendMessageInChannel("[b][ADMIN] [/b]" + Utils.GetStringOfNLength(numberCharacters), channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { int channelsNumber = bot.ChannelsJoined.Count(); TimeSpan onlineTime = DateTime.UtcNow - bot.LoginTime; bot.SendMessageInChannel("Dice Bot was developed by [user]Darkness Syndra[/user] on 10/12/2020" + "\nversion " + BotMain.Version + "\ncurrently operating in " + channelsNumber + " channels." + "\nonline for " + Utils.GetTimeSpanPrint(onlineTime) + "\nfor a list of commands, see the profile [user]Dice Bot[/user].", channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings thisChannel = bot.GetChannelSettings(channel); if (thisChannel.AllowTableRolls) { bool includeLabel = true; bool secondaryRolls = true; if (terms != null && terms.Length >= 1 && terms.Contains("nolabel")) { includeLabel = false; } if (terms != null && terms.Length >= 1 && terms.Contains("nosecondary")) { secondaryRolls = false; } int rollModifier = commandController.GetRollModifierFromCommandTerms(terms); string tableName = commandController.GetTableNameFromCommandTerms(terms); SavedRollTable savedTable = Utils.GetTableFromId(bot.SavedTables, tableName); if (savedTable.DefaultTable || thisChannel.AllowCustomTableRolls) { string sendMessage = bot.DiceBot.GetRollTableResult(bot.SavedTables, tableName, characterName, channel, rollModifier, includeLabel, secondaryRolls, 3); bot.SendMessageInChannel(sendMessage, channel); } else { bot.SendMessageInChannel("Only default talbes are allowed in this channel under " + Utils.GetCharacterUserTags("Dice Bot") + "'s settings for this channel.", 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) { string cardName = Utils.GetFullStringOfInputs(rawTerms); List <SavedDeck> possibleDecks = bot.SavedDecks.Where(a => a.DeckList.Contains(cardName)).ToList(); string allReturned = ""; if (possibleDecks != null && possibleDecks.Count >= 1) { foreach (SavedDeck saved in possibleDecks) { if (!string.IsNullOrEmpty(allReturned)) { allReturned += ", "; } int startIndex = saved.DeckList.IndexOf(cardName); string relevant = saved.DeckList.Substring(startIndex); string[] remainingCards = relevant.Split(','); if (remainingCards[0].Contains('|')) { string[] thisSplit = remainingCards[0].Split('|'); DeckCard d = new DeckCard() { specialName = thisSplit[0], description = thisSplit[1] }; allReturned += d.FullDescription(); } else { DeckCard d = new DeckCard() { specialName = remainingCards[0] }; allReturned += d.FullDescription(); } allReturned += " (" + saved.DeckId + ")"; } } else { allReturned = "The card '" + cardName + "' was not found."; } bot.SendMessageInChannel("[i]Card Info: [/i]" + allReturned, channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { ChannelSettings existing = bot.GetChannelSettings(channel); string sendMessage = "[b]Added[/b] " + channel + " to list of startup channels."; if (existing.StartupChannel) { sendMessage = "[b]Removed[/b] " + channel + " from list of startup channels."; } existing.StartupChannel = !existing.StartupChannel; Utils.WriteToFileAsData(bot.SavedChannelSettings, Utils.GetTotalFileName(BotMain.FileFolder, BotMain.ChannelSettingsFileName)); bot.SendMessageInChannel(sendMessage, channel); }
public override void Run(BotMain bot, BotCommandController commandController, string[] rawTerms, string[] terms, string characterName, string channel, UserGeneratedCommand command) { int numberRolled = Utils.GetNumberFromInputs(terms); string resultString = ""; if (numberRolled > DiceBot.MaximumDice) { resultString = "Error: Cannot roll more than " + DiceBot.MaximumDice + " dice."; } else { resultString = bot.DiceBot.RollFitD(numberRolled); } bot.SendMessageInChannel(resultString, channel); }