Example #1
0
 public ScheduledJob(SchedulePlugin schedulePlugin, INoobotCore noobotCore, ILog logger, StatsPlugin statsPlugin)
 {
     _schedulePlugin = schedulePlugin;
     _noobotCore = noobotCore;
     _log = logger;
     _statsPlugin = statsPlugin;
 }
Example #2
0
    public HelperMiddleware(IMiddleware next, StatsPlugin statsPlugin, JsonStoragePlugin jsonStoragePlugin)
        : base(next)
    {
        _r = new Random();
        this._statsPlugin    = statsPlugin;
        _jsonStoragePlugin   = jsonStoragePlugin;
        this.HandlerMappings = new HandlerMapping[1]
        {
            new HandlerMapping()
            {
                ValidHandles  = new[] { new AlwaysMatchHandle() },
                Description   = "Gets search result from discourse",
                EvaluatorFunc = DiscourseSearch
            }
        };

        jokes = jsonStoragePlugin.ReadFile <Joke>("jokes").ToList();
        if (!jokes.Any())
        {
            jokes.Add(new Joke()
            {
                Content = "bcash is the superior cryptocurrency because big blocks are cool, I guess"
            });
        }
    }
Example #3
0
 public SchedulePlugin(StoragePlugin storagePlugin, INoobotCore noobotCore, StatsPlugin statsPlugin, ILog log)
 {
     _storagePlugin = storagePlugin;
     _noobotCore = noobotCore;
     _statsPlugin = statsPlugin;
     _log = log;
 }
Example #4
0
 public SchedulePlugin(StoragePlugin storagePlugin, INoobotCore noobotCore, StatsPlugin statsPlugin, ILog log)
 {
     _storagePlugin = storagePlugin;
     _noobotCore    = noobotCore;
     _statsPlugin   = statsPlugin;
     _log           = log;
 }
Example #5
0
 public ScheduledJob(SchedulePlugin schedulePlugin, INoobotCore noobotCore, ILog logger, StatsPlugin statsPlugin)
 {
     _schedulePlugin = schedulePlugin;
     _noobotCore     = noobotCore;
     _log            = logger;
     _statsPlugin    = statsPlugin;
 }
 public WelcomeMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles = new []{"hi", "hey", "hello", "wuzzup"},
             Description = "Try saying hi and see what happens",
             EvaluatorFunc = WelcomeHandler
         }
     };
 }
Example #7
0
 public StatsMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles = new []{ "stats" },
             Description = "Returns interesting stats about your noobot installation",
             EvaluatorFunc = StatsHandler
         }
     };
 }
Example #8
0
 public WelcomeMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles  = new [] { "hi", "hey", "hello", "wuzzup" },
             Description   = "Try saying hi and see what happens",
             EvaluatorFunc = WelcomeHandler
         }
     };
 }
Example #9
0
 public JokeMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles = new [] { "joke", "tell me a joke"},
             Description = "Tells a random joke",
             EvaluatorFunc = JokeHandler
         }
     };
 }
Example #10
0
 public StatsMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles  = ExactMatchHandle.For("stats"),
             Description   = "Returns interesting stats about your noobot installation",
             EvaluatorFunc = StatsHandler
         }
     };
 }
Example #11
0
 public PaniniMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles  = new [] { "panini" },
             Description   = "Panini is love, Panini is life",
             EvaluatorFunc = WelcomeHandler
         }
     };
 }
 public JokeMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles  = ExactMatchHandle.For("joke", "tell me a joke"),
             Description   = "Tells a random joke",
             EvaluatorFunc = JokeHandler
         }
     };
 }
        public FlickrMiddleware(IMiddleware next, IConfigReader configReader, StatsPlugin statsPlugin) : base(next)
        {
            _configReader = configReader;
            _statsPlugin  = statsPlugin;

            HandlerMappings = new[]
            {
                new HandlerMapping
                {
                    ValidHandles  = ExactMatchHandle.For("flickr", "pic"),
                    Description   = "Finds a pics from flickr - usage: /flickr birds",
                    EvaluatorFunc = FlickrHandler,
                }
            };
        }
Example #14
0
        public FlickrMiddleware(IMiddleware next, IConfigReader configReader, StatsPlugin statsPlugin) : base(next)
        {
            _configReader = configReader;
            _statsPlugin = statsPlugin;

            HandlerMappings = new[]
            {
                new HandlerMapping
                {
                    ValidHandles = new [] { "flickr", "pic"},
                    Description = "Finds a pics from flickr - usage: /flickr birds",
                    EvaluatorFunc = FlickrHandler,
                }
            };
        }
Example #15
0
 public StopMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles             = new [] { "" },
             Description              = "Stop",
             EvaluatorFunc            = CommandHandler,
             MessageShouldTargetBot   = true,
             ShouldContinueProcessing = true,
             VisibleInHelp            = true
         }
     };
 }
Example #16
0
        /// <summary>
        /// Requires config entry 'jira:prefix', 'jira:url' and 'jira:base64Token' to be populated
        /// </summary>
        public JiraMiddleware(IMiddleware next, IConfigReader configReader, StatsPlugin statsPlugin) : base(next)
        {
            _configReader = configReader;
            _statsPlugin  = statsPlugin;

            string prefix = _configReader.GetConfigEntry <string>("jira:prefix");

            HandlerMappings = new[]
            {
                new HandlerMapping
                {
                    ValidHandles  = ContainsTextHandle.For(prefix),
                    Description   = "Gets information about Jira ticket",
                    EvaluatorFunc = JiraHandler,
                }
            };
        }
Example #17
0
 public WebQueryMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles  = new [] { "MSDN" },
             Description   = "Return a list of MSDN articles",
             EvaluatorFunc = MSDN
         },
         new HandlerMapping
         {
             ValidHandles  = new [] { "Urban" },
             Description   = "Return Urban Definition",
             EvaluatorFunc = Urban
         }
     };
 }
Example #18
0
 public CalculatorMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles = new []{"calc"},
             Description = "Calculate mathematical expressions - usage: calc ((1+2)*3)/4",
             EvaluatorFunc = CalculateHandler,
             MessageShouldTargetBot = false
         },
         new HandlerMapping
         {
             ValidHandles = new []{""},
             Description = "Try to calculate mathematical expressions without the 'calc' prefix - usage: ((1+2)*3)/4",
             EvaluatorFunc = CalculateHandler,
             MessageShouldTargetBot = false,
             ShouldContinueProcessing = true
         }
     };
 }
        public ScheduleMiddleware(IMiddleware next, SchedulePlugin schedulePlugin, StatsPlugin statsPlugin) : base(next)
        {
            _schedulePlugin = schedulePlugin;
            _statsPlugin = statsPlugin;

            HandlerMappings = new[]
            {
                new HandlerMapping
                {
                    ValidHandles = new [] { "schedule hourly"},
                    Description = "Schedule a command to execute every hour on the current channel. Usage: `@{bot} schedule hourly @{bot} tell me a joke`",
                    EvaluatorFunc = HourlyHandler,
                },
                new HandlerMapping
                {
                    ValidHandles = new [] { "schedule daily"},
                    Description = "Schedule a command to execute every day on the current channel. Usage: `@{bot} schedule daily @{bot} tell me a joke`",
                    EvaluatorFunc = DayHandler,
                },
                new HandlerMapping
                {
                    ValidHandles = new [] { "schedule cronjob"},
                    Description = "Schedule a cron job for this channel. Usage: `@{bot} schedule cronjob '0 15 10 * * ?' @{bot} tell me a joke`",
                    EvaluatorFunc = CronHandler,
                },
                new HandlerMapping
                {
                    ValidHandles = new [] { "schedule list"},
                    Description = "List all schedules on the current channel",
                    EvaluatorFunc = ListHandlerForChannel,
                },
                new HandlerMapping
                {
                    ValidHandles = new [] { "schedule delete"},
                    Description = "Delete a schedule in this channel. You must enter a valid {guid}",
                    EvaluatorFunc = DeleteHandlerForChannel,
                },
            };
        }
Example #20
0
 public SlackTest(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     this.HandlerMappings = new HandlerMapping[]
     {
         new HandlerMapping()
         {
             ValidHandles  = ExactMatchHandle.For("can i have a beer", "what time is it"),
             Description   = "Checks if it is Beer O Clock",
             EvaluatorFunc =
                 new Func <IncomingMessage, IValidHandle, IEnumerable <ResponseMessage> >(this.CheckWhatTimeItIs),
             VisibleInHelp = false
         },
         new HandlerMapping()
         {
             ValidHandles  = ExactMatchHandle.For("test"),
             Description   = "Checks if it is Beer O Clock",
             EvaluatorFunc =
                 new Func <IncomingMessage, IValidHandle, IEnumerable <ResponseMessage> >(this.Booop),
             VisibleInHelp = false
         },
     };
 }
 public CalculatorMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin    = statsPlugin;
     HandlerMappings = new[]
     {
         new HandlerMapping
         {
             ValidHandles           = new [] { "calc" },
             Description            = "Calculate mathematical expressions - usage: calc ((1+2)*3)/4",
             EvaluatorFunc          = CalculateHandler,
             MessageShouldTargetBot = false
         },
         new HandlerMapping
         {
             ValidHandles             = new [] { "" },
             Description              = "Try to calculate mathematical expressions without the 'calc' prefix - usage: ((1+2)*3)/4",
             EvaluatorFunc            = CalculateHandler,
             MessageShouldTargetBot   = false,
             ShouldContinueProcessing = true
         }
     };
 }
    public HelperMiddleware(IMiddleware next, StatsPlugin statsPlugin, JsonStoragePlugin jsonStoragePlugin)
        : base(next)
    {
        _r = new Random();
        this._statsPlugin    = statsPlugin;
        _jsonStoragePlugin   = jsonStoragePlugin;
        this.HandlerMappings = new HandlerMapping[1]
        {
            new HandlerMapping()
            {
                ValidHandles  = new[] { new AlwaysMatchHandle() },
                Description   = "Supreme Ruler Roger Ver does not need to explain himself to you",
                EvaluatorFunc = DiscourseSearch
            }
        };
        jokes               = jsonStoragePlugin.ReadFile <Joke>("jokes").ToList();
        PinCodes            = jsonStoragePlugin.ReadFile <PinCode>("pincodes").ToList();
        UpdateSubscriptions = jsonStoragePlugin.ReadFile <UpdateSubscription>("subscriptions").ToList();
        if (!jokes.Any())
        {
            jokes.Add(new Joke()
            {
                Content = "bcash is the superior cryptocurrency because big blocks are cool, I guess"
            });
        }

        if (!PinCodes.Any())
        {
            PinCodes.Add(new PinCode()
            {
                Pin    = "7dd7aa3a-a5e3-42d5-b651-1de152c75bcb",
                UserId = "U96S14QGY"
            });
        }

        _httpClient = new HttpClient();
    }
Example #23
0
 public SchedulePlugin(StructuremapJobFactory jobFactory, JsonStoragePlugin storagePlugin, StatsPlugin statsPlugin)
 {
     _jobFactory    = jobFactory;
     _storagePlugin = storagePlugin;
     _statsPlugin   = statsPlugin;
 }
Example #24
0
 public BeginMessageMiddleware(IMiddleware next, StatsPlugin statsPlugin, ILog log) : base(next)
 {
     _statsPlugin = statsPlugin;
     _log         = log;
 }
Example #25
0
 public BeginMessageMiddleware(IMiddleware next, StatsPlugin statsPlugin, ILog log) : base(next)
 {
     _statsPlugin = statsPlugin;
     _log = log;
 }
 public BeginMessageMiddleware(IMiddleware next, StatsPlugin statsPlugin, ILogger logger) : base(next)
 {
     this._statsPlugin = statsPlugin;
     this._logger      = logger;
 }
Example #27
0
 public BeginMessageMiddleware(IMiddleware next, StatsPlugin statsPlugin) : base(next)
 {
     _statsPlugin = statsPlugin;
 }
Example #28
0
 public SchedulePlugin(StructuremapJobFactory jobFactory, JsonStoragePlugin storagePlugin, StatsPlugin statsPlugin)
 {
     _jobFactory = jobFactory;
     _storagePlugin = storagePlugin;
     _statsPlugin = statsPlugin;
 }