npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hubot-traq

v1.8.1

Published

Hubot adapter for traQ.

Downloads

89

Readme

hubot-traq

npm version automatic deploy MIT License

traQHubotアダプター

使い方

新しいbotをつくる

インストール

前提としてNode.jsが必要です

# 利用ツールのインストール
npm install -g hubot coffee-script yo generator-hubot
# botを管理するディレクトリの作成
mkdir -p /path/to/hubot
cd /path/to/hubot
# テンプレートの作成
yo hubot

ここまでしたら、画面にしたがって入力していき、Bot adapterと表示されたらtraqと入力します
(もしくはyo hubotのあとにすべてコマンド引数で指定することもできます)

既定で入っているscriptsが存在するので一度除きます(このままだとredisがないだの怒られるため)
./external-scripts.jsonを開いて[]にします
package.jsondependencieshubothubot-traq以外を取り除いてnpm installをするといいかもしれません
さらに./hubot-scripts.jsonを消すと非推奨というエラーが出なくなります

# gitレポジトリの作成
git init
git add .
git commit -m "Init"

初期設定

下記の環境変数をそれぞれ設定します

  • HUBOT_TRAQ_NAME - traQで動かすHubotのtraQ ID (例: @BOT_TESTならBOT_TEST)
  • HUBOT_TRAQ_MODE - BOTのモード (HTTPまたはWebSocket、省略時はHTTP)
  • HUBOT_TRAQ_ACCESS_TOKEN - traQで動かすHubotのAccess Token
  • HUBOT_TRAQ_EMBED - メンション・チャンネルリンクの自動埋め込みの有無(TRUEにすると有効、省略時は無効)
  • PORTまたはEXPRESS_PORT - HTTPモードでのポート (省略時は8080)
  • 以下はHTTPモードのときのみ必要
    • HUBOT_TRAQ_VERIFY_TOKEN - traQで動かすHubotのVerification Code
    • HUBOT_TRAQ_PATH - Botサーバーエンドポイントのパス(直下で受け取るなら""/webhook/で受け取るなら"/webhook/")

Verification CodeなどはそれぞれtraQのBot Consoleから確認できます

実行

./bin/hubot -a traq -n "$HUBOT_TRAQ_NAME"

showcase.yaml

type: runtime
startup: |
  npm install -g coffee-script
  npm ci
entrypoint: exec node_modules/.bin/hubot -a traq -n "$HUBOT_TRAQ_NAME" "$@"
http_proxy: 8080

このようにするとshowcaseで実行できます

javascript coffeescript typescript

./scripts/example.coffeeが存在していますが、拡張子が.coffeeではなく.jsのファイルを./scriptsに置くことでcoffeescriptではなくJavaScriptで書くことも可能です
ただし、この場合でもnpm install -g coffee-scriptは必要です

また、Typescriptで書くことも可能です。
ただし、あまり型の恩恵を受けれないと思います…。


さらに詳しい説明はhubotのドキュメントを参照してください

Changelog

リファレンス