karl-run / haikubot Goto Github PK
View Code? Open in Web Editor NEWA Slackbot that polls your Stash server and post your pull-request haikus to a slack channel!
License: MIT License
A Slackbot that polls your Stash server and post your pull-request haikus to a slack channel!
License: MIT License
Since a sprint has different length at different projects
Title is: Haiku #[105]
Should be: Haiku #105
A giant function in bot.py is not a good way to handle commands.
But only if the user is a "bot-mod".
Scenario
@haikubot guess author
Currently, if you ask for the bot to show you 1+n haiku it will do 1+n network requests. Instead it should to something similar to whet it shows the top list, just have several attachments in one call. This should probably be limited to some max value.
This will include to clean up how haikus are passed around. A lot of the times a haiku will be passed into a function by passing in individual values in a dict.
E.g: @haikubot show stats top 3 weeks
When on a unstable connection the websocket will fail and produce a websocket._exceptions.WebSocketConnectionClosedException:
, it should try and reconnect when this happens.
This does not affect Stash polling and posting new haikus, only commands.
Export to haikus.txt with the contents looking like this:
Haiku haiku hai
ku haiku haiku haiku
Haiku haiku hai
One Two Three Four Five
Six Seven Eight Nine Ten El
even Twelve Thirteen
...
A lot of fun things can be created by a good integration with the reactions in slack.
Slack does not provide an id to messages i the event-api when given reactions but the timestamp ts
of the message.
The posted haiku:
{'bot_id': 'XXXXXXXXX', 'suppress_notification': False, 'type': 'message', 'text': '', 'user': 'XXXXXXXXX', 'team': 'XXXXXXXXX', 'bot_profile': {'id': 'XXXXXXXXX', 'deleted': False, 'name': 'bot', 'updated': 1476284487, 'app_id': 'XXXXXXXXX', 'icons': {'image_36': 'https://url.com/image', 'image_48': 'https://url.com/image', 'image_72': 'https://url.com/image'}, 'team_id': 'XXXXXXXXX'}, 'attachments': [{'fallback': 'Haiku #3331 av Sindre Bilden', 'text': 'this is just a test\nthere is nothing to see here\nplease move along now', 'title': 'Haiku #3331', 'footer': '- Sindre Bilden', 'id': 1, 'color': '5d799e'}], 'source_team': 'XXXXXXXXX', 'user_team': 'XXXXXXXXX', 'channel': 'XXXXXXXXX', 'event_ts': '1594409951.033600', 'ts': '1594409951.033600'}
Reaction to the posted haiku:
{'type': 'reaction_added', 'user': 'XXXXXXXXX', 'item': {'type': 'message', 'channel': 'XXXXXXXXX', 'ts': '1594409951.033600'}, 'reaction': '+1:', 'item_user': 'XXXXXXXXX', 'event_ts': '1594410088.033800', 'ts': '1594410088.033800'}
The timestamp ts: '1594409951.033600'
acts as an identifier in the channel.
If haikubot listens for its own post of haikus, the timestamp in the database can be updated to match the timestamp from slack, thus indirectly provide an id.
If you're running the bot with log.INFO logging level you're probably still interested if Stash is down or not authenticating you.
Example:
bot_1 | 2017-02-14 08:02:04,450 root DEBUG: Parsing stash response: {'errors': [{'context': None, 'message': 'You are not permitted to access this resource', 'exceptionName': 'com.atlassian.bitbucket.AuthorisationException'}]}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.