Home

Awesome

AliceGoogleImages Hex Version Deps Status Hex Downloads License: MIT

This handler will allow Alice to look up random images on Google Images

Installation

If available in Hex, the package can be installed as:

  1. Add alice_google_images to your list of dependencies in mix.exs:
```elixir
defp deps do
   [
     {:websocket_client, github: "jeremyong/websocket_client"},
     {:alice, "~> 0.3"},
     {:alice_google_images, "~> 0.1"}
   ]
end
```

2. Add the handler to your list of registered handlers in mix.exs:

```elixir
def application do
  [applications: [:alice],
    mod: {
      Alice, [Alice.Handlers.GoogleImages, ...]}]
end
```

Configuration

Custom Search Engine

Google no longer offers an unregistered image search API. You must set up a Google Custom Search API.

The Custom Search API provides up to 100 search queries per day for free. If you need more than that you'll have to pay.

CSE setup details

  1. Create a CSE via these instructions.
  1. Turn on images in Edit Search Engine > Setup > Basic > Image Search
  2. Get the CSE ID in Edit Search Engine > Setup > Basic > Details (via these instructions)
  3. Get the CSE KEY here https://code.google.com/apis/console
  1. Enable Custom Search API
  1. Update your conf (and your modules if necessary)

Configure Alice

In your bot's config.exs:

config :alice_google_images,
  cse_id: System.get_env("GOOGLE_CSE_ID"),
  cse_token: System.get_env("GOOGLE_CSE_TOKEN"),
  safe_search_level: :medium # other possible values are :high or :off

Usage

Use @alice help for more information.