-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1f6f595
Showing
9 changed files
with
1,350 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# GitHub | ||
HUBOT_GITHUB_TOKEN=TODO | ||
HUBOT_GITHUB_USER=JoinColony | ||
HUBOT_GITHUB_REPO=colonyDapp | ||
|
||
# Figma | ||
HUBOT_FIGMA_TOKEN=TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.DS_Store* | ||
.hubot_history | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Chewie | ||
|
||
Chewie is a handy bot for doing Colony things. It's built on Hubot and is very extensible! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
"hubot-diagnostics", | ||
"hubot-help", | ||
"hubot-github-status" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "chewie", | ||
"version": "0.0.0", | ||
"private": true, | ||
"author": "Scott Street <[email protected]>", | ||
"description": "A handy bot for doing Colony things", | ||
"scripts": { | ||
"start": "env-cmd .env yarn run hubot --name chewie -a slack", | ||
"dev": "env-cmd .env yarn run hubot --name chewie" | ||
}, | ||
"dependencies": { | ||
"env-cmd": "^8.0.2", | ||
"figma-js": "^1.3.4", | ||
"githubot": "^1.0.1", | ||
"hubot": "^3.0.1", | ||
"hubot-diagnostics": "0.0.2", | ||
"hubot-github-status": "^0.2.1", | ||
"hubot-help": "^0.2.2", | ||
"hubot-slack": "^4.4.0" | ||
}, | ||
"engines": { | ||
"node": "0.10.x" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Description: | ||
// Post Figma previews when linked | ||
// | ||
// Commands: | ||
// https://www.figma.com/file/... - display a Figma preview | ||
// | ||
// Dependencies: | ||
// 'figma-js': '1.3.x' | ||
// | ||
// Author: | ||
// sprusr | ||
|
||
const Figma = require('figma-js') | ||
|
||
module.exports = (robot) => { | ||
const figma = Figma.Client({ | ||
personalAccessToken: process.env.HUBOT_FIGMA_TOKEN | ||
}) | ||
|
||
robot.hear(/https:\/\/www.figma.com\/file\/([A-z0-9]*)\/?/, async msg => { | ||
try { | ||
const fileId = msg.match[1] | ||
const file = await figma.file(fileId) | ||
const name = file.data.name | ||
const thumbnail = file.data.thumbnailUrl | ||
msg.send(`${name} ${thumbnail}`) | ||
} catch (error) { | ||
console.error(error) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Description: | ||
// Links to GitHub issues when posted in the shorthand user/repo#nnn | ||
// Adapted from https://github.com/github/hubot-scripts/blob/master/src/scripts/github-issue-link.coffee | ||
// | ||
// Dependencies: | ||
// 'githubot': '0.4.x' | ||
// | ||
// Configuration: | ||
// HUBOT_GITHUB_REPO | ||
// HUBOT_GITHUB_TOKEN | ||
// | ||
// Commands: | ||
// #nnn - link to GitHub issue nnn for HUBOT_GITHUB_REPO project | ||
// repo#nnn - link to GitHub issue nnn for repo project | ||
// user/repo#nnn - link to GitHub issue nnn for user/repo project | ||
// | ||
// Author: | ||
// sprusr | ||
|
||
module.exports = function(robot) { | ||
const github = require('githubot')(robot) | ||
const ignoreUsers = 'github|hubot' | ||
const apiUrl = 'https://api.github.com' | ||
|
||
robot.hear(/((\S*|^)?#(\d+)).*/, msg => { | ||
const issue = msg.match[3] | ||
|
||
if (msg.message.user.name.match(new RegExp(ignoreUsers, 'gi'))) return | ||
if (isNaN(issue)) return | ||
|
||
const repo = msg.match[2] | ||
? github.qualified_repo(msg.match[2]) | ||
: github.qualified_repo(process.env.HUBOT_GITHUB_REPO) | ||
|
||
github.get(`${apiUrl}/repos/${repo}/issues/${issue}`, res => { | ||
const title = res.title | ||
const url = res.html_url | ||
const type = res.pull_request ? "PR" : "Issue" | ||
msg.send(`${type} ${issue}: ${title} ${url}`) | ||
}) | ||
}) | ||
} |
Oops, something went wrong.