public bool TryHandle(SlackBotCommandContext context, CancellationToken token, out Task task)
        {
            // dumper et arkiv og poster til en channel (som attachment)

            task = null;
            return(false);
        }
Esempio n. 2
0
        public bool TryHandle(SlackBotCommandContext context, CancellationToken token, out Task task)
        {
            task = null;

            if (!string.Equals(context.IncomingMessage.Text, "Ping", StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }



            task = context.WriteText($"[{Environment.MachineName}{_postFix}]: I'm up and running, thanks. Uptime: {_uptime.UptimeText}.");

            return(true);
        }
Esempio n. 3
0
        public bool TryHandle(SlackBotCommandContext context, CancellationToken token, out Task task)
        {
            task = null;

            string taskName = context.IncomingMessage.Text;

            ITask taskToExecute;

            if (!string.IsNullOrWhiteSpace(taskName) && _factory.TryGet(taskName, out taskToExecute))
            {
                task = context.WriteText($"Task {taskToExecute.Name()} is being executed.")
                       .ContinueWith(t => Task.FromResult(_runner.Execute(taskToExecute)), token)
                       .ContinueWith(t => context.WriteText($"Task {taskToExecute.Name()} finished executing."), token);
            }

            return(task != null);
        }