private void OffCommand(IInvokeSource source, ParsedRequest request) { RequireModerator(source); if (!roundsManager.Enabled) { source.Reply("Bot is already disabled."); } else { source.Reply("Disabling bot..."); roundsManager.Enabled = false; } }
private void StopCommand(IInvokeSource source, ParsedRequest request) { RequireModerator(source); if (!roundsManager.Enabled) { source.Reply("Bot is not enabled!"); } else { source.Reply("Stopping round..."); roundsManager.ForceStop(); } }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireEdit(); bool enabled; if (message.Count >= 1) { try { enabled = Boolean.Parse(message.Args[0]); } catch (Exception ex) { throw new CommandException("Unable to parse parameter: enabled", ex); } } else { enabled = !this.PlayerService.OwnPlayer.IsGod; } this.ActionService.GodMode(enabled); source.Reply("God mode was set to {0}.", enabled); }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); string key = message.GetTrail(0); this.RoomService.ChangeKey(key); source.Reply("Set key to {0}.", key); }
private void Run(IInvokeSource source, ParsedCommand message) { Player player = this.PlayerService.MatchPlayer(message.Args[0]); this.Chatter.Unmute(player.Username); source.Reply("Unmuted {0}.", player.ChatName); }
private void Run(IInvokeSource source, ParsedCommand message) { Player player = this.PlayerService.MatchPlayer(message.Args[0]); this.Chatter.ReportAbuse(player.Username, message.GetTrail(1)); source.Reply("Reported {0}.", player.ChatName); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); var name = message.GetTrail(0); this.RoomService.SetName(name); source.Reply("Name changed to: {0}", name); }
public void Invoke(IInvokeSource source, ParsedCommand message) { var e = new InvokeEvent(source, message); this.Events.Raise(e); if (!e.Handled && source.Group >= this.ResponseMinGroup) source.Reply(UnknownCommandStr); }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); if (message.Count == 0 || message.Args[0] != "SAVE") throw new CommandException("To use save, type !save SAVE"); this.RoomService.Save(); source.Reply("Saved."); }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); if (message.Count == 0 || message.Args[0] != "CLEAR") throw new CommandException("To use clear, type !clear CLEAR"); this.RoomService.Clear(); source.Reply("Cleared level."); }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); Player player = this.GetPlayerOrSelf(source, message); this.RequireSameRank(source, player); this.Chatter.GiveEdit(player.Username); source.Reply("Gave edit to {0}.", player.ChatName); }
protected override void Run(IInvokeSource source, ParsedCommand message) { string key = String.Empty; if (message.Count >= 1) key = message.GetTrail(0); this.RoomService.Access(key); source.Reply("Access sent."); }
protected override void Run(IInvokeSource source, ParsedCommand message) { if (message.Count >= 1) { string user = message.Args[0]; this.PlayerService.MatchPlayer(user, player => source.Reply("{0}'s rank is {1}", player.ChatName, player.GetGroup()), username => source.Reply("{0} is now {1}.", PlayerUtils.GetChatName(username), this.Host.GetPermission(PlayerUtils.GetStorageName(username)))); } var playerSource = source as PlayerInvokeSource; if (playerSource != null) { source.Reply("{0}'s rank is {1}", playerSource.Player.ChatName, playerSource.Player.GetGroup()); } else { throw new UnknownPlayerCommandException("No player was specified!"); } }
private void Run(IInvokeSource source, ParsedCommand message) { Smiley smiley; try { smiley = (Smiley)Enum.Parse(typeof(Smiley), message.Args[0], true); } catch (Exception ex) { throw new CommandException("Unable to parse parameter: smiley", ex); } this.ActionService.ChangeFace(smiley); source.Reply("Smiley set to {0}.", smiley); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); bool isAllowed; try { isAllowed = Boolean.Parse(message.Args[0]); } catch (Exception ex) { throw new CommandException("Unable to parse parameter: isAllowed", ex); } this.RoomService.SetAllowPotions(isAllowed); source.Reply("Potions enabled: {0}.", isAllowed); }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); bool isVisible; try { isVisible = Boolean.Parse(message.Args[0]); } catch (Exception ex) { throw new CommandException("Unable to parse parameter: isVisible", ex); } this.Chatter.ChangeVisibility(isVisible); source.Reply("Changed visibility to {0}.", isVisible); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); Player player = this.PlayerService.MatchPlayer(message.Args[0]); this.RequireSameRank(source, player); if (message.Count >= 3) { int x = message.GetInt(1); int y = message.GetInt(2); this.Chatter.Teleport(player.Username, x, y); } else if (message.Count == 2) { try { Player target = this.PlayerService.MatchPlayer(message.Args[1]); this.Chatter.Teleport(player.Username, target.BlockX, target.BlockY); } catch (CommandException ex) { throw new CommandException(ex.Message + " Parameter: target", ex); } } else { var playerSource = source as PlayerInvokeSource; if (playerSource != null) { int x = playerSource.Player.BlockX; int y = playerSource.Player.BlockX; this.Chatter.Teleport(player.Username, x, y); } else { this.Chatter.Teleport(player.Username); } } source.Reply("Teleported {0}.", player.ChatName); }
protected override void Run(IInvokeSource source, ParsedCommand message) { Potion pot; try { pot = (Potion)Enum.Parse(typeof(Potion), message.Args[0], true); } catch (Exception ex) { throw new CommandException("Unable to parse parameter: potion", ex); } try { this.PotionService.UsePotion(pot); } catch (InvalidOperationException ex) { throw new CommandException("Unable to use potion: " + ex.Message, ex); } source.Reply("Potion {0} used.", pot); }
protected override void Run(IInvokeSource source, ParsedCommand message) { bool enabled; if (message.Count >= 1) { try { enabled = Boolean.Parse(message.Args[0]); } catch (Exception ex) { throw new CommandException("Unable to parse parameter: enabled", ex); } } else { enabled = !this.PlayerService.OwnPlayer.IsGuardian; } this.ActionService.GuardianMode(enabled); source.Reply("Guardian mode was set to {0}.", enabled); }
void HiCommand(IInvokeSource source, ParsedRequest request) { source.Reply("Hello"); }
private void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); this.Chatter.RespawnAll(); source.Reply("Respawned all."); }
private void Run(IInvokeSource source, ParsedCommand message) { source.Reply("Restarting..."); this.HostService.Restart(); }
protected override void Run(IInvokeSource source, ParsedCommand message) { source.Reply("Hello!"); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); this.Chatter.KillAll(); source.Reply("Killed everyone."); }
private static void HiCommand(IInvokeSource source, ParsedRequest request) { var player = source.ToPlayerInvokeSource().Player; source.Reply("Hello world {0}!", player.Username); }
private void Run(IInvokeSource source, ParsedCommand message) { source.Reply("Pong."); }
private void Run(IInvokeSource source, ParsedCommand message) { source.Reply("Shutting down..."); this.HostService.Shutdown(); }
public static void Reply(this IInvokeSource invokeSource, string message, params object[] args) { // ReSharper disable once RedundantStringFormatCall invokeSource.Reply(string.Format(message, args)); }
private void Run(IInvokeSource source, ParsedCommand message) { this.KeyService.PressKey(Key.Blue); source.Reply("Pressed blue key."); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.KeyService.PressKey(Key.Green); source.Reply("Pressed green key."); }
private void Run(IInvokeSource source, ParsedCommand message) { this.ActionService.GetCrown(); source.Reply("Got crown."); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); this.Chatter.LoadLevel(); source.Reply("Loaded level."); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); this.Chatter.Reset(); source.Reply("Level reset."); }
protected override void Run(IInvokeSource source, ParsedCommand message) { this.RequireOwner(); this.Chatter.PotionsOn(message.Args); source.Reply("Enabled potions: {0}", message.GetTrail(0)); }