예제 #1
0
        public CommandHandler()
        {
            LinkExpander = new LinkExpander();
            PubFileHandler = new PubFileCommand();

            RegisteredCommands = new List<Command>
            {
                new BlogCommand(),
                new PlayersCommand(),
                new AppCommand(),
                new PackageCommand(),
                new SteamIDCommand(),
                new GIDCommand(),
                PubFileHandler,
                new UGCCommand(),
                new EnumCommand(),
                new ServersCommand(),
                new BinariesCommand(),
                new ImportantCommand(),
                new ReloginCommand(),
            };

            // Register help command last so we can pass the list of the commands
            RegisteredCommands.Add(new HelpCommand(RegisteredCommands));

            Log.WriteInfo("CommandHandler", "Registered {0} commands", RegisteredCommands.Count);
        }
예제 #2
0
        public CommandHandler()
        {
            LinkExpander   = new LinkExpander();
            PubFileHandler = new PubFileCommand();

            RegisteredCommands = new List <Command>
            {
                new BlogCommand(),
                new PlayersCommand(),
                new AppCommand(),
                new PackageCommand(),
                new SteamIDCommand(),
                new GIDCommand(),
                PubFileHandler,
                new UGCCommand(),
                new EnumCommand(),
                new ServersCommand(),
                new BinariesCommand(),
                new ImportantCommand(),
                new ReloginCommand(),
            };

            // Register help command last so we can pass the list of the commands
            RegisteredCommands.Add(new HelpCommand(RegisteredCommands));

            Log.WriteInfo("CommandHandler", "Registered {0} commands", RegisteredCommands.Count);
        }
예제 #3
0
        private void OnServiceMethod(SteamUnifiedMessages.ServiceMethodResponse callback)
        {
            JobAction job;

            if (!JobManager.TryRemoveJob(callback.JobID, out job) || !job.IsCommand)
            {
                return;
            }

            var request = job.CommandRequest;

            if (callback.Result != EResult.OK)
            {
                CommandHandler.ReplyToCommand(request.Command, "Unable to make service request: {0}", callback.Result);

                return;
            }

            // .chat about grate
            switch (request.Type)
            {
            case JobManager.IRCRequestType.TYPE_GAMESERVERS:
                ServersCommand.OnServiceMethod(callback, request);
                return;

            case JobManager.IRCRequestType.TYPE_PUBFILE:
            case JobManager.IRCRequestType.TYPE_PUBFILE_SILENT:
                PubFileCommand.OnServiceMethod(callback, request);
                return;
            }

            CommandHandler.ReplyToCommand(request.Command, "Unknown request type, I don't know what to do.");
        }
        public CommandHandler()
        {
            LinkExpander   = new LinkExpander();
            PubFileHandler = new PubFileCommand();

            RegisteredCommands = new List <Command>
            {
                new BlogCommand(),
                new PlayersCommand(),
                new AppCommand(),
                new PackageCommand(),
                new SteamIDCommand(),
                new GIDCommand(),
                PubFileHandler,
                new UGCCommand(),
                new EnumCommand(),
                new ServersCommand(),
                new BinariesCommand(),
                new ImportantCommand(),
                new ReloginCommand(),
            };

            if (Settings.Current.CanQueryStore)
            {
                RegisteredCommands.Add(new QueueCommand());
                RegisteredCommands.Add(new KeyCommand());
            }

            // Register help command last so we can pass the list of the commands
            RegisteredCommands.Add(new HelpCommand(RegisteredCommands));

            DiscordRelayMessageRegex = new Regex(
                "^<(?<name>.+?)\x03> (?<message>.+)$",
                RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture
                );

            Log.WriteInfo("CommandHandler", "Registered {0} commands", RegisteredCommands.Count);
        }