Exemplo n.º 1
0
        public async Task <bool> Step3(ISlackSocket socket, Message message, SlackUser user)
        {
            if (message.text != "3")
            {
                await socket.Send(message.Reply("oh, I didn't expect that. Lets start again"));

                return(false);
            }

            await socket.Send(message.Reply("ok that's the end. You're back at the beginning..."));

            user.NextStep = null;
            return(true);
        }
Exemplo n.º 2
0
        public async Task <bool> Step2(ISlackSocket socket, Message message, SlackUser user)
        {
            if (message.text != "2")
            {
                await socket.Send(message.Reply("oh, I didn't expect that. Lets start again"));

                return(false);
            }

            await socket.Send(message.Reply("what about step 3? Enter '3' to continue"));

            user.NextStep = Step3;
            return(true);
        }
Exemplo n.º 3
0
        public static void SendSelf(this ISlackSocket socket, string message)
        {
            var msg = new Message
            {
                user    = socket.State.Self.id,
                channel = socket.State.Self.id,
                text    = message
            };

            socket.Send(msg);
        }
Exemplo n.º 4
0
        public Task Respond(ISlackSocket socket, Message message, SlackUser user)
        {
            var response = new StringBuilder();

            foreach (var r in socket.Responders)
            {
                var attr = (DescriptionAttribute)r.GetType().GetCustomAttributes(typeof(DescriptionAttribute), true).FirstOrDefault();
                if (attr?.Description == "!")
                {
                    continue;
                }
                string name = CapitalToSpace(r.GetType().Name.Replace("Responder", string.Empty));
                response.AppendLine($"*{name}* - {attr?.Description}");
            }

            return(socket.Send(message.Reply("Here's is what I know \n>>>" + response.ToString())));
        }
Exemplo n.º 5
0
 public Task Respond(ISlackSocket socket, Message message, SlackUser user)
 {
     return(socket.Send(message.Reply("ECHO: " + message.text.Replace("echo", string.Empty))));
 }
Exemplo n.º 6
0
 public Task Respond(ISlackSocket socket, Message message, SlackUser user)
 {
     socket.Send(message.Reply("hey"));
     return(Task.FromResult(0));
 }
Exemplo n.º 7
0
        public async Task Respond(ISlackSocket socket, Message message, SlackUser user)
        {
            await socket.Send(message.Reply("what about step 2? Enter '3' to continue"));

            user.NextStep = Step2;
        }