Skip to content

Commit

Permalink
Added typing signal on Meowi and Giphy
Browse files Browse the repository at this point in the history
  • Loading branch information
purrplingcat committed Sep 2, 2017
1 parent 322826b commit 6b9ec03
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions plugins/Giphy/giphy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ exports.init = function(pluginName) {
}

function fetchAndSendMyGif(message, tag, type) {
message.channel.startTyping();
var request_url = `http://api.giphy.com/v1/${type}/random?api_key=${API_KEY}&tag=${tag}`;
logger.log("Request url: " + request_url + "\ttag: " + tag);
request({
url: request_url,
json: true,
}, function (error, response, body) {
var result = null;
message.channel.stopTyping();
if (!error && response.statusCode === 200 && body) {
result = body.data.url || "Nothing found for keyword: " + tag;
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/Meowii/meowii.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ exports.init = function(pluginName) {
function fetchAndSendMyGif(message, tag) {
var request_url = "http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=" + tag;
logger.log("Request url: " + request_url + "\ttag: " + tag);
message.channel.startTyping();
request({
url: request_url,
json: true,
}, function (error, response, body) {
var result = null;
message.channel.stopTyping();
if (!error && response.statusCode === 200) {
result = body.data.url;
}
Expand Down

0 comments on commit 6b9ec03

Please sign in to comment.