public SetPermNick(SettingsInstance settings) { _settings=settings; }
public Bot(SettingsInstance settings) { _streamHandler = new StreamHandler(this); _commandHandler = new CommandHandler(); _settings = settings; Logger.Info("StreamBot Version " + Assembly.GetCallingAssembly().GetName().Version); foreach (var stream in _settings.GetStreams()) { _streamHandler.AddStream(stream.Name, stream.Url); } // Load up all the commands _commandHandler.Add("!streamers", new ListStreams(_streamHandler) { ErrorMessage = "Sorry, there are no streamers.", }); _commandHandler.Add("!streams", new ListStreams(_streamHandler, x => x.Online) { ErrorMessage = "Sorry, no one is currently streaming.", Format = "Current online streamers: {0}", }); _commandHandler.Add("!stream", new StreamInfo(_streamHandler)); _commandHandler.Add("!about", new Respond( "To see a list of currently live streams, write !streams. " + "If you want to start streaming and don't know how, write !guide. " + "To get your stream added, message one of the !operators. ")); _commandHandler.Add("!guide", new Respond( "A step by step guide on how to set up your own stream can be found here: " + "http://vidyadev.com/wiki/A_guide_to_streaming")); _commandHandler.Add("!addstream", new SecureCommand(x => x.Permission.IsOperator, new AddStream(_streamHandler, _settings) )); _commandHandler.Add("!version", new Respond(Assembly.GetCallingAssembly().GetName().Version.ToString())); _commandHandler.Add("!delstream", new SecureCommand(x => x.Permission.IsOperator, new DelStream(_streamHandler, _settings) )); _commandHandler.Add("!streaming", new Streaming(_streamHandler)); _commandHandler.Add("!update", new UpdateStream(_streamHandler)); _commandHandler.Add("!addperm", new SecureCommand(x => x.Permission.IsSuperOperator, new AddPerm(_settings) )); _commandHandler.Add("!delperm", new SecureCommand(x => x.Permission.IsSuperOperator, new DelPerm(_settings) )); _commandHandler.Add("!operators", new ListPerms(_settings, x => x.Permission.IsOperator)); _commandHandler.Add("!setpermnick", new SetPermNick(_settings)); // Create a suspended stream-check timer _checkTimer = new Timer(StreamTimer, null, TimeSpan.FromMilliseconds(-1), TimeSpan.FromMilliseconds(-1)); Logger.Info("Bot loaded, ready to connect."); }