Created
December 4, 2018 04:55
-
-
Save pizzacat83/d5ce7f507cfbe9df1605fb159658912a to your computer and use it in GitHub Desktop.
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
function doPost(e){ | |
console.log(e.parameter.trigger_word); | |
var slackApp = SlackApp.create(slackAccessToken); | |
if(e.parameter.trigger_word=="formula:"){ | |
var chId=e.parameter.channel_id; | |
var query = e.parameter.text.substr(e.parameter.trigger_word.length).trim(); | |
var url="https://chart.googleapis.com/chart?cht=tx&chl="+encodeURIComponent(query.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'))+"&ts="+String(Date.now()); | |
slackApp.postMessage(chId, url, {'username':'formula','icon_url':"http://icons.iconarchive.com/icons/alecive/flatwoken/512/Apps-Libreoffice-Math-B-icon.png"}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment