Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Logic and Tests for Slack SDK v3 support #309

Merged
merged 46 commits into from
Jul 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
744359d
updated logic and tests to support v3 of node-slack-sdk
Jun 16, 2016
e5dd2f8
clean up unused functions
Jun 16, 2016
c244c3d
reverted clean up of unused functions
Jun 17, 2016
cd61c60
added some coveralls tests and ignores
Jun 17, 2016
62062c7
No function getBody()
Jun 20, 2016
710454c
Repair the missing getBody method, not updated in testing
Jun 20, 2016
7441fad
This should handle a number of the errors we've seen
Jun 21, 2016
d5b5cd7
corrected package.json
Jun 21, 2016
2a66fb4
fixed channel test
Jun 21, 2016
7679d26
Initial attempt at fixing #114 to correct formatting urls
Jun 27, 2016
900402e
an attempt at rewriting to have better support for complex messages a…
Jul 1, 2016
93d01dc
adjusted method names
Jul 1, 2016
0224285
adjusted method names
Jul 1, 2016
09514bf
Merge pull request #314 from slackhq/hubot-v4-proto
Jul 1, 2016
9153bf5
Fix errors handling message with un-handled subtypes that may or may …
Jul 1, 2016
4e078ac
Getting at least some of the tests to pass. This is terrible.
Jul 1, 2016
aef4233
Tests are running...and passing!
Jul 5, 2016
12bcff4
Look at that, so many green lights.
Jul 5, 2016
705ffd2
All original passing tests are now in and passing.
Jul 5, 2016
ad68cdd
Fixing Silliness
Jul 5, 2016
3bfdc18
Don't need that! Doesn't work in the stub anyway.
Jul 5, 2016
341e54d
This is an experiment
Jul 5, 2016
8a8d19d
Make this node 0.10 compatible
Jul 5, 2016
09d4dd6
Merge pull request #315 from slackhq/v3-sdk-updates-writing-tests
Jul 5, 2016
306142b
More tests on SlackFormatter, and a bug fix!
Jul 5, 2016
d3e7f53
Clean up beforeEach triggers
Jul 5, 2016
48de700
Adding tests for client
gtr32x Jul 8, 2016
881b5a9
Filling in the remainder of the tests for client
gtr32x Jul 11, 2016
2aab972
Updating package.json to reflect future reality
Jul 12, 2016
d93be77
added robot logger coverage
Jul 14, 2016
3e6ae9e
Making the tests a little more specific.
Jul 14, 2016
43d3c65
Tests around replying...and found a bug
Jul 14, 2016
179b424
Small victories
Jul 14, 2016
7249c89
Adding tests on receiving messages
Jul 14, 2016
e85b67d
One more test, commiting to set it aside.
Jul 14, 2016
1def6e8
Fix that broken test.
Jul 14, 2016
25a4b6c
Message handling tests
Jul 14, 2016
b5683c3
Fixing some errors, writing some tests
Jul 14, 2016
4f3f430
There is no bot_message anymore
Jul 14, 2016
8a21aa3
CHeck error event handling
Jul 14, 2016
e2fbdd6
Merge pull request #321 from slackhq/v3-coverage
Jul 14, 2016
4639968
Updating the docs
Jul 15, 2016
2d3160e
Minor tweaks to README
Jul 15, 2016
e71cf7c
Merge pull request #322 from slackhq/v3-docs
Jul 15, 2016
e375beb
Because Hubot adapters have very strict naming restrictions
Jul 15, 2016
09ba54d
Merge branch 'master' into v3-sdk-updates
Jul 15, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
.idea
coverage/
npm-debug.log
*.log
.DS_Store
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# [slack-hubot] Changelog

### v4.0.0 (2016-06-15)

* Now uses the latest version of `node-slack-sdk` (v3.4.1 as of this writing), inheriting all the improvements therein.
* Better (and automatically enabled) reconnect logic. As in, it actually reconnects automatically at all.
* Now you can upload files!
* Significantly improved handling of messages with attachments, which is to say, we can deliver them.
* Message formatting of links, usernames and channel names is now working far better than it ever did, which is damning with faint praise, but hey.
* Long messages are now left for Slack to handle, bless their hearts.
* Slack usernames with `.` and `-` are now treated with the respect and dignity due to all usernames.
* Messages from bots are no longer filtered out, which is both cool and potentially terrifying, but we should never have silenced the robots in the first place.
* Remember how if you tried to hack on this adapter and used `npm link` to plug that into a live bot? And how that didn't work? Yeah? Well now it does. Stupid `instanceof`.
* Total refactoring of the functionality, exposing a slightly different interface. So watch out for that.
* You can now access the underlying Slack client directly, for when you really need low-level functionality therein.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there documentation available on how to do just that ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.rtm or .web will return the clients.

.send is just a shortcut to select the best method.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

34 changes: 34 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Slack open source code of conduct


## Introduction
Diversity and inclusion make our community strong. We encourage participation from the most varied and diverse backgrounds possible and want to be very clear about where we stand.

Our goal is to maintain a safe, helpful and friendly community for everyone, regardless of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other defining characteristic.

This code and related procedures also apply to unacceptable behavior occurring outside the scope of community activities, in all community venues (online and in-person) as well as in all one-on-one communications, and anywhere such behavior has the potential to adversely affect the safety and well-being of community members.

## Expected Behavior
* Be welcoming.
* Be kind.
* Look out for each other.

## Unacceptable Behavior
* Conduct or speech which might be considered sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory or offensive in nature.
* Unwelcome, suggestive, derogatory or inappropriate nicknames or terms.
* Disrespect towards others. (Jokes, innuendo, dismissive attitudes.)
* Intimidation or harassment (online or in-person). Please read the [Citizen Code of Conduct](http://citizencodeofconduct.org/) for how we interpret harassment.
* Disrespect towards differences of opinion.
* Inappropriate attention or contact. Be aware of how your actions affect others. If it makes someone uncomfortable, stop.
* Not understanding the differences between constructive criticism and disparagement.
* Sustained disruptions.
* Violence, threats of violence or violent language.

## Enforcement
Understand that speech and actions have consequences, and unacceptable behavior will not be tolerated.

If you are the subject of, or witness to any violations of this Code of Conduct, please contact us by submitting a form [here](https://docs.google.com/a/slack-corp.com/forms/d/1NVqj2S2Q49XVIOT5N3L6Tx1oihvk9CpMa_UX8T_6ESo/viewform), or email conduct@slack.com.

If violations occur, organizers will take any action they deem appropriate for the infraction, up to and including expulsion.

_Thanks to the [Django Code of Conduct](https://www.djangoproject.com/conduct/), [The Citizen Code of Conduct](http://citizencodeofconduct.org/), [The Rust Code of Conduct](https://www.rust-lang.org/conduct.html) and [The Ada Initiative](http://adainitiative.org/2014/02/18/howto-design-a-code-of-conduct-for-your-community/)._
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Contributing at Slack

![Header Image](contributing_header_slack.png)

## Before Contributing

Before contributing, please read our [Code of Conduct](./CODE_OF_CONDUCT.md). We take it very seriously, and expect that you will as well.

## New Issues

Before opening a new issue, please consider:

- Reading [the documentation](./README.md) and [the changelog](./README.md) first.
- Searching for any related issues and avoid creating duplicated issues.
- Adding details, diagnoses, screenshots or any type of useful information in existing issues, even if they are marked as closed. The team will still review it.
- Taking the time to think of a solution and [**open a pull request**](#new-pull-requests) for either improving the documentation, fixing a bug or suggesting a feature.
- Finally, **[open an issue]**(https://github.com/slackhq/hubot-slack/issues/new) to report a bug, ask for help or suggest a feature. The more information you give, the better people can help you.


## New Pull Requests

We love pull requests and we are generally very receptive to contributions. Things to keep in mind:

- [Fork the repository](https://github.com/slackhq/slack-hubot) and make sure to work on a branch up to date with origin master.
- Do your thing!
- Be mindful about doing atomic commits, adding documentation to your changes, not refactoring too much.
- Add tests covering the new code or functionality you are adding.
- Add a descriptive title and add any useful information for the reviewer. If your contribution is a user facing thing, please attach a screenshot and/or screencast (gif preferrably).
- Read and agree to our [Contributor License Agreement (CLA)](https://docs.google.com/a/slack-corp.com/forms/d/1q_w8rlJG_x_xJOoSUMNl7R35rkpA7N6pUkKhfHHMD9c/viewform). _We cannot accept your PR without your agreement to our CLA_.
- Create your pull request (yay!). If it is in relation to an existing issue, please mention it on the title or description.

[Interested in knowing more about about pull requests at Slack?](https://slack.engineering/on-empathy-pull-requests-979e4257d158#.awxtvmb2z)
20 changes: 0 additions & 20 deletions Gruntfile.coffee

This file was deleted.

28 changes: 28 additions & 0 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
* [ ] I've read and understood the [Contributing guidelines](./CONTRIBUTING.md) and have done my best effort to follow them.
* [ ] I've read and agree to the [Code of Conduct](./CODE_OF_CONDUCT.md).
* [ ] I've searched for any related issues and avoided creating a duplicate issue.

#### Description
> e.g. Description of the bug or feature

#### Reproducible in:
{project_name} version:
OS version(s):
Device(s):

#### Steps to reproduce:

1.
2.
3.

### Expected result:
> e.g. What you expected to happen

### Actual result:
> e.g. What actually happened

### Attachments:
> e.g. Logs, screenshots, screencast, sample project, funny gif, etc.


4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
MIT License

Copyright (c) Slack Technologies, Inc.

Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 changes: 15 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
* [ ] I've read and understood the [Contributing guidelines](./CONTRIBUTING.md) and have done my best effort to follow them.
* [ ] I've read and agree to the [Code of Conduct](./CODE_OF_CONDUCT.md).
* [ ] I've been mindful about doing atomic commits, adding documentation to my changes, not refactoring too much.
* [ ] I've a descriptive title and added any useful information for the reviewer. Where appropriate, I've attached a screenshot and/or screencast (gif preferrably).
* [ ] I've written tests to cover the new code and functionality included in this PR.
* [ ] I've read, agree to, and signed the [Contributor License Agreement (CLA)](https://docs.google.com/a/slack-corp.com/forms/d/1q_w8rlJG_x_xJOoSUMNl7R35rkpA7N6pUkKhfHHMD9c/viewform).

#### PR Summary
> e.g. New functionality for producing whatsits.

#### Related Issues
> e.g. Fixes #206 and closes #230

#### Test strategy
> e.g. Add tests around whatsit production.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

This is a [Hubot](http://hubot.github.com/) adapter to use with [Slack](https://slack.com).

[![Build Status](https://travis-ci.org/slackhq/hubot-slack.svg)](https://travis-ci.org/slackhq/hubot-slack)
[![Coverage Status](https://coveralls.io/repos/github/slackhq/hubot-slack/badge.svg?branch=master)](https://coveralls.io/github/slackhq/hubot-slack?branch=master)
[![Travis branch](https://img.shields.io/travis/slackhq/hubot-slack/master.svg?maxAge=2592000)]()
[![Coveralls](https://img.shields.io/coveralls/slackhq/hubot-slack.svg?maxAge=2592000)]()
[![npm (scoped)](https://img.shields.io/npm/v/hubot-slack.svg?maxAge=2592000)]()

## Getting Started

Expand Down Expand Up @@ -41,7 +42,7 @@ This is a modified set of instructions based on the [instructions on the Hubot w

- Profit!

## Upgrading from earlier versions of Hubot
## Upgrading from version 2 or earlier of Hubot

Version 3 of the hubot-slack adapter requires different server support to
previous versions. If you have an existing "hubot" integration set up you'll
Expand Down Expand Up @@ -73,4 +74,4 @@ If you're using the [hubot-auth](https://github.com/hubot-scripts/hubot-auth/) s

## Copyright

Copyright © Slack Technologies, Inc. MIT License; see LICENSE for further details.
Copyright © 2014–2016 Slack Technologies, Inc. MIT License; see LICENSE for further details.
Binary file added contributing_header_slack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 0 additions & 15 deletions index.coffee

This file was deleted.

19 changes: 14 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "hubot-slack",
"version": "3.4.2",
"version": "4.0.0",
"description": "A Slack adapter for hubot",
"main": "./index",
"main": "./slack",
"scripts": {
"test": "npm run mocha && istanbul report text-summary lcov",
"coveralls": "cat ./coverage/lcov.info | coveralls",
Expand All @@ -24,9 +24,11 @@
"url": "https://github.com/slackhq/hubot-slack/issues"
},
"dependencies": {
"slack-client": "~1.5"
"@slack/client": "^3.4.0",
"lodash": "^3.10.1"
},
"devDependencies": {
"hubot": "~2.11",
"coffee-coverage": "^1.0.1",
"coffee-script": "~1.7.1",
"coveralls": "^2.11.9",
Expand All @@ -35,13 +37,12 @@
"grunt-contrib-watch": "~0.5.3",
"grunt-release": "~0.6.0",
"grunt-shell": "~0.5.0",
"hubot": "~2.11",
"istanbul": "^0.4.3",
"mocha": "~1.13.0",
"should": "~2.0.2"
},
"engines": {
"node": ">=0.4.7",
"node": ">= 0.10.x",
"npm": ">= 1.1.x"
},
"contributors": [
Expand All @@ -65,6 +66,14 @@
{
"name": "Eric Lindvall",
"email": "eric@papertrailapp.com"
},
{
"email": "don@slack-corp.com",
"name": "D.E. Goodman-Wilson"
},
{
"email": "jagan@slack-corp.com",
"name": "John Agan"
}
]
}
4 changes: 4 additions & 0 deletions slack.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SlackBot = require './src/bot'

exports.use = (robot) ->
new SlackBot robot, token: process.env.HUBOT_SLACK_TOKEN
Loading