LoginSignup
1
1

More than 5 years have passed since last update.

Hubot | 自作Script | ume.coffee - 空行を挿入する

Posted at

Hubot | 自作Script | ume.coffee - 空行を挿入する

概要

ume.coffee - 空行を挿入するScriptを作成します

用途

  • 画像系コマンドなどで、妙な画像を取得してしまった場合
  • 急に思わぬ人が来た場合

などに、チャットのビューを空行で埋めて既存のチャットを画面外に追いやるための利用を想定。

仕様

filename

ume.coffee

埋め、ですね。

respond or hear

respond

起動メッセージ

  • 正規表現
/ume+( (\d+))?/
  • 具体例
    • ume # => 空行を15行挿入
    • ume 5 # => 空行を 5行挿入

ソースコード

# Description
#   Output empty lines
#
# Dependencies:
#   None
#
# Configuration:
#   None
#
# Commands:
#   hubot ume N - Output N-empty-lines. If you omit N, lines set 15.
#
# Author:
#   tbpgr
module.exports = (robot) ->

  robot.respond /ume+( (\d+))?/i, (msg) ->
    lines = msg.match[2] || 15
    msg.send '' for [1..lines]

試行

デフォルト

ume1.png

2行

ume2.png

補足

今のところ、 npm で公開したりする予定はないので適当にGitHubに突っ込んでおきます。
https://github.com/tbpgr/hubot_scripts/tree/master/ume

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1