问题描述
由于某些原因,现有的Giphy应用程序松弛,不允许机器人从giphy.com调用GIF.
For some reason, the existing Giphy app for slack does not allow bots to call a GIF from giphy.com
如果我输入"/Giphy sad",则Giphy应用程序将自动从Giphy.com加载某种悲伤的GIF
If I type "/Giphy sad", the Giphy app will automatically load a sad GIF of somekind from Giphy.com
但是,如果我的slackbot做到了这一点,或者我的hubot或我的twitterbot或我创建的任何bot,即使文本相同,也将无法使用.我假设这是因为giphy故意排除了能够调用该命令的漫游器?还是机器人通常无法调用命令?
But if my slackbot does it, or my hubot, or my twitterbot, or any bot that I create, even if the text is identical, it won't work. I'm assuming this is because giphy intentionally excluded bots from being able to call the command? Or is it that bots can't call commands in general?
因此,除了这个一般性问题之外,我的具体编码问题是:使其成为松弛应用程序或机器人可以从Giphy调用GIF的最佳方法是什么?
So in addition to this general question, my specific coding question is: what would be the best way to make it so that a slack app or a bot can call a GIF from Giphy?
您可能不需要的其他信息:-我正在创建它,以便我们可以将Twitter帐户中的心情"拉到一个松弛的频道中,并在该松弛的频道中显示一堆GIF,它们代表了推文的心情.-我一直在使用Node-Red来做一些这样的事情-我尝试过使用内置的Twitter应用程序来保持松弛,没有骰子
additional info you may not need:-I'm creating this so that we can pull "moods" off of Twitter account into a slack channel and have a bunch of GIFs show up in that slack channel that represent the mood of the tweets. -I've been using Node-Red to do some of this-I've tried using the built in twitter app for slack, no dice
推荐答案
Bot用户无法调用Slash命令.这是 Slack 的限制,而不是Giphy或任何其他集成的限制. :(
Bot users cannot invoke Slash commands. This is a restriction by Slack and not Giphy or any other integration. :(
因此,如果您想从Giphy获取gif图像,则必须使用Giphy API自己实现.幸运的是,Giphy API非常易于使用. Giphy API
So if you want to get gifs from Giphy, you will have to implement that yourself using the Giphy API. Thankfully, the Giphy API is super easy to use. Giphy API
在最近的黑客马拉松项目中,我构建了此对于Slack,您可能会发现它很有用.它是来自Giphy的随机gif,标记为失败",然后将其作为消息发布在Slack中.
In a recent hackathon project I built this for Slack, which you may find useful. It get's a random gif that is tagged "fail" from Giphy and then posts it as a message in Slack.
这篇关于我如何做到这一点,以便松弛的机器人可以使用Giphy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!