cycle-discord-google-api
v0.1.4
Published
Cycle component to write a bot for Discord
Downloads
7
Readme
Cycle.js Google API component for Discord
Usage
$ npm install cycle-discord-google-api
import {Observable} from 'rx'
import {run} from '@cycle/core'
import {makeHTTPDriver} from '@cycle/http'
import makeDiscordDriver from 'cycle-discord'
import {GoogleApi, IMAGE_SEARCH_URL} from 'cycle-discord-google-api'
run(GoogleApi, {
HTTP: makeHTTPDriver(),
Discord: makeDiscordDriver({/**/}),
props: () => Observable.of({
URL: `${IMAGE_SEARCH_URL}&key=YOUR_API_KEY`,
trigger: /^search image (.*)$/,
transform: result => result.link
})
})
This example will add a listener on messages like search image foo bar and respond with the link of the result of a Google Image search