import { SearchBaseClass } from "../../helpers/search"; export interface GIPHYResult { id: string; title: string; url: string; images: { downsized_large: { url: string }; preview_gif: { url: string }; }; user?: { avatar_url: string; display_name: string; profile_url: string; }; } export default class GIPHY extends SearchBaseClass { constructor(apiKey: string) { super({ apiKey, name: "giphy", icon: ``, color: "#a800ff", noRecolor: true, poweredByUrl: "https://giphy.com", popularEndpoint: (apiKey: string) => `https://api.giphy.com/v1/gifs/trending?api_key=${apiKey}&limit=18&rating=G`, searchEndpoint: (apiKey: string, query: string) => `https://api.giphy.com/v1/gifs/search?api_key=${apiKey}&q=${encodeURIComponent( query )}&limit=18&offset=0&rating=G&lang=en`, getButton: (image: GIPHYResult) => `
`, getSearchResults: (response: { data: GIPHYResult[] }) => response.data, getPopularResults: (response: { data: GIPHYResult[] }) => response.data, }); } }