GithubHelp home page GithubHelp logo

hubot-slack-timeline's People

Contributors

tunagohan avatar vexus2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

hubot-slack-timeline's Issues

hubot-slack v4になりチャンネル名がIDとして表示されてしまう問題

背景

hubot-slack v4にアップデートされ
msg.envelope.roomが チャンネル名 ではなく チャンネルID として表示されるようになった

⚠️ 問題点

その為hubot-slack-timelineで(at #{チャンネル名})と表示される部分が(at #{チャンネルID})として表示されてしまう為、修正が必要だと考えます。

🎓 解決策 / 解決案

メソッドを利用しIDからチャンネル名に変換することで対応できると考えられます。

request = require 'request'
module.exports = (robot) ->
  robot.hear /.*?/i, (msg) ->
    channel = msg.envelope.room
+   room_name = robot.adapter.client.rtm.dataStore.getChannelGroupOrDMById(channel).name
...(略)
-     request = msg.http("https://slack.com/api/chat.postMessage?token=#{process.env.SLACK_API_TOKEN}&channel=%23#{timeline_channel}&text=#{message}%20(at%20%23#{channel}%20)&username=#{username}&link_names=#{link_names}&pretty=1&icon_url=#{user_image}").get()
+     request = msg.http("https://slack.com/api/chat.postMessage?token=#{process.env.SLACK_API_TOKEN}&channel=%23#{timeline_channel}&text=#{message}%20(at%20%23#{room_name}%20)&username=#{username}&link_names=#{link_names}&pretty=1&icon_url=#{user_image}").get()
      request (err, res, body) ->

最後に

素晴らしいスクリプトをありがとうございます!
便利なスクリプトで大変助かっております。
ぜひ修正案を参考に修正していただけると幸いです。 :octocat:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.