{"action":"opened","issue":{"url":"https://api.github.com/repos/go-chat-bot/bot/issues/90","repository_url":"https://api.github.com/repos/go-chat-bot/bot","labels_url":"https://api.github.com/repos/go-chat-bot/bot/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/go-chat-bot/bot/issues/90/comments","events_url":"https://api.github.com/repos/go-chat-bot/bot/issues/90/events","html_url":"https://github.com/go-chat-bot/bot/issues/90","id":374055067,"node_id":"MDU6SXNzdWUzNzQwNTUwNjc=","number":90,"title":"Tweaks for periodic commands (allow periodic command without predefined channel) ","user":{"login":"sochotnicky","id":55726,"node_id":"MDQ6VXNlcjU1NzI2","avatar_url":"https://avatars0.githubusercontent.com/u/55726?v=4","gravatar_id":"","url":"https://api.github.com/users/sochotnicky","html_url":"https://github.com/sochotnicky","followers_url":"https://api.github.com/users/sochotnicky/followers","following_url":"https://api.github.com/users/sochotnicky/following{/other_user}","gists_url":"https://api.github.com/users/sochotnicky/gists{/gist_id}","starred_url":"https://api.github.com/users/sochotnicky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sochotnicky/subscriptions","organizations_url":"https://api.github.com/users/sochotnicky/orgs","repos_url":"https://api.github.com/users/sochotnicky/repos","events_url":"https://api.github.com/users/sochotnicky/events{/privacy}","received_events_url":"https://api.github.com/users/sochotnicky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-25T17:35:44Z","updated_at":"2018-10-25T17:35:44Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I've mentioned this in the original JIRA plugin issue to some degree - I am planning (one final) feature that would query JIRA for issues that were created/resolved in given project and announce them to a channel. \r\n\r\nTo do this I was planning to use periodicCommands. However - looking at the code the way they work means the JIRA query would be run for every channel (even if multiple channels receive notifications of the same project).\r\n\r\nWhat I would instead like to do is have a periodicCommand (v2?) that runs the queries (in JIRA case configured by ENV vars) and can send a message to any channel depending on which new/resolved issues it found.  I was thinking of doing something like this:\r\n```\r\n// PeriodicConfig holds a cron specification for periodically notifying the configured channels\r\ntype PeriodicConfig struct {\r\n        Version     int     <---- NEW\r\n        CronSpec string                               // CronSpec that schedules some function\r\n        Channels []string                             // A list of channels to notify\r\n        CmdFunc  func(channel string) (string, error) // func to be executed at the period specified on CronSpec\r\n        CmdFuncV2 func() ([]CmdResultV2, error) <--- NEW\r\n}\r\n```\r\nAnd of course, tweak the bot.go to account for this so that when V2 func is called it will send all messages. There are other ways to do this of course so before I go down that road - any preferences/ideas?"}}
{"actor":{"display_login":"sochotnicky"}}