private IEnumerable<ResponseMessage> ListPingHandler(IncomingMessage message, string matchedHandle) { string[] users = _pingPlugin.ListPingedUsers(); yield return message.ReplyDirectlyToUser("I am currently pinging:"); yield return message.ReplyDirectlyToUser(">>>" + string.Join("\n", users)); }
private IEnumerable<ResponseMessage> WelcomeHandler(IncomingMessage message, string matchedHandle) { _statsPlugin.IncrementState("Hello"); yield return message.ReplyToChannel($"Hey @{message.Username}, how you doing?"); Thread.Sleep(TimeSpan.FromSeconds(5)); yield return message.ReplyDirectlyToUser("I know where you live..."); }
private IEnumerable<ResponseMessage> HelpHandler(IncomingMessage message, string matchedHandle) { var builder = new StringBuilder(); builder.Append(">>>"); IEnumerable<CommandDescription> supportedCommands = GetSupportedCommands().OrderBy(x => x.Command); foreach (CommandDescription commandDescription in supportedCommands) { string description = commandDescription.Description.Replace("@{bot}", $"@{_noobotCore.GetBotUserName()}"); builder.AppendFormat("{0}\t- {1}\n", commandDescription.Command, description); } yield return message.ReplyDirectlyToUser(builder.ToString()); }
private IEnumerable<ResponseMessage> AdminHelpHandler(IncomingMessage message, string matchedHandle) { if (!_adminPlugin.AuthenticateUser(message.UserId)) { yield return message.ReplyToChannel($"Sorry {message.Username}, only admins can use this function."); yield break; } foreach (var handlerMapping in HandlerMappings) { string mappings = string.Join(" | ", handlerMapping.ValidHandles.Select(x => $"{x}")); yield return message.ReplyDirectlyToUser($"`{mappings}` - {handlerMapping.Description}"); } }
private IEnumerable<ResponseMessage> AboutHandler(IncomingMessage message, string matchedHandle) { yield return message.ReplyDirectlyToUser("Noobot - Created by Simon Colmer " + DateTime.Now.Year); yield return message.ReplyDirectlyToUser("I am an extensible SlackBot built in C# using loads of awesome open source projects."); yield return message.ReplyDirectlyToUser("Please find more at http://github.com/noobot/noobot"); }
private IEnumerable<ResponseMessage> AutoResponseHandler(IncomingMessage message, string matchedHandle) { yield return message.ReplyDirectlyToUser(message.FullText); }