Activate the Giphy search feature in the Slack Nestor bot's response

How can the nestor bot be configured to use a giphy search when replying in a Slack channel where the giphy plugin is active? Can something like

msg.reply('/giphy ' + text, done);
be used for this purpose?

Answer №1

I recently discovered that they are not permitted here. To work around this restriction, I utilized the superagent npm library for ajax calls along with the giphy api in my slackbot code as shown below:

  var url = 'https://api.giphy.com/v1/gifs/search?q=' + 'searchString' + '&api_key=dc6zaTOxFJmzC&rating=r';
  request.get(url).end( function(err, res) {
    // console.log(res.body.data)
    bot.reply(message, 'Here is a giphy for you: ' + searchString + giph);
});

I hope this solution proves to be useful.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Shut down jquery modal

I have successfully imported Jquery Modal using the following two links (js and css) <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-modal/0.9.1/jquery.modal.min.js"></script> <link rel="stylesheet" href="https://cdnjs.cl ...

Guide on importing CDN Vue into a vanilla Typescript file without using Vue CLI?

In the midst of a large project that is mostly developed, I find myself needing to integrate Vue.js for specific small sections of the application. To achieve this, I have opted to import Vue.js using a CDN version and a <script> </script> tag ...

Getting the Correct Nested Type in TypeScript Conditional Types for Iterables

In my quest to create a type called GoodNestedIterableType, I aim to transform something from Iterable<Iterable<A>> to just A. To illustrate, let's consider the following code snippet: const arr = [ [1, 2, 3], [4, 5, 6], ] type GoodN ...

Unlocking the Power of Angular: Transforming Input into Results

I'm currently exploring how to utilize an input field and fetch a response using Angular directly within the script. As a beginner, I came across this script on codepen. At the end of the code, I've attempted to make a call but haven't compl ...

I have a brief snippet of JavaScript code that demonstrates how to access properties

Is there a way to make the following javascript code more concise? It creates an object with the element's id as key and the element itself as value. const createWrapper = elem => { return {[elem.id]: elem} } Example: createWrapper({id:&apos ...

Flawless Carousel - Flipping the Sequence

I am currently implementing Slick Carousel on a website that I am working on. One challenge I am encountering is trying to get the "slider-nav" to move in the opposite direction than it normally does. For instance, at the moment, the order goes like this ...

Using Formik with Material UI's TextField component and passing a 'label' prop to the Field component

Currently, I am in the process of creating a form with Formik and Material UI. I have implemented the Formik component as follows: Within my Input component, the following code is used: const Input = ({ field, form: { errors } }) => { const errorMes ...

Incorporating CouchDB storage into a Node.js socket.io JSON data stream

Currently in the process of researching how to implement persistence for a real-time Twitter JSON feed in Node.js. The stream is set up and sending data to the client, but I'm struggling with storing this information in a CouchDB database so that it c ...

Exploring the Efficiency Enhancements in the next/image Optimization Process within Next.js

I've been delving into Next.js and using the next/image component for image rendering. While leveraging it to enhance image loading in my project, I've become intrigued by the intricate workings behind the scenes. I'm particularly interested ...

Having trouble with setting up ENV variables while deploying the app on Heroku

I recently deployed my node.js app to Heroku, and I'm facing some issues with its functionality. The app loads fine, but when I try to sign in, it breaks down. It seems like the environment variables are not loading correctly, specifically the db vari ...

Refreshing a specific div within an HTML page

I am facing an issue with the navigation on my website. Currently, I have a div on the left side of the page containing a nav bar. However, when a user clicks a link in the nav bar, only the content on the right side of the page changes. Is there a way t ...

Angular successfully compiled without any issues despite the explicit cast of a number into a string variable

As I delve into the initial concepts of Angular, I have come across a puzzling situation. Here is the code snippet: import { Component } from '@angular/core'; @Component({ selector: 'sandbox', template: ` <h1>Hello {{ nam ...

Extracting information from a JSON data within an API

How can I retrieve data with a name tag from JSON data using Ajax? The function showCard is not functioning properly when I try to grab data with a name tag. My goal is to display the name of the API data when an img element with the class found is clicked ...

I require assistance in troubleshooting and repairing my HTML and JavaScript code

I am working on creating a feature where users can input their upcoming birthday date and receive an alert showing how many days are left until then. However, I encountered an issue where the alert displays NaN (Not a Number) before the birthday is entered ...

Using JQuery to dynamically set dropdown option values from a JSON object

I have an HTML code snippet: $.ajax({ type: "POST", url: "hanca/hanca_crud.php", dataType: 'json', data: { id_hanca: id_hanca, type: "detail_hanca" }, //detail_hanca success: function(data) { var teks = ""; $.each( ...

Enter a socket.IO chat room upon accessing an Express route

Encountering difficulty when attempting to connect to a socket.IO room while accessing a specific route in my Express application. The current setup is as follows: app.js var express = require('express'); var app = express(); var http = requir ...

Deleting a row from a table in Angular when a form is submitted

I am new to using Angular and I have been attempting to remove certain elements from a table upon submission. <tr ng-repeat="val in values "> <td ng-bind="$index"></td> <td ng-bind="val.rec">ED1500322</td> <td& ...

Restrict the duration of time a user can spend in the v-calendar

I'm currently developing a project where users can request appointments. I'm utilizing the v-calendar library, which incorporates a datepicker. The challenge I'm facing is that users are able to request appointments at any time of day, 24/7 ...

What is the best way to change a JavaScript variable into a PHP variable?

I am interested in converting my JavaScript variable to a PHP variable... Currently, I have the following scenario - in the code below there is a variable e, but I would like to utilize e in PHP as $e: <script> function test() { var e = documen ...

Preserving information throughout an online browsing session

Is there a way to save the data about which buttons a user clicked on while visiting our website without using a database? The issue is that any array I use gets reset every time the user is redirected from the page. Note: I'm still learning PHP ...