Skip to content

Allows Alice to look up random images on Google Images

Notifications You must be signed in to change notification settings

alice-bot/alice_google_images

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
```
  1. 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.
  • To simulate the old behavior: select "Search the entire web but emphasize included sites" in 'Sites to Search'
  • Give it any site on creation, and then remove it when it's selected, unless you want to emphasize that site(s).
  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
  • You will need a project, you may reuse an existing one, or create a new one
  • Select the project
  • Goto the API manager and create a server credential and use the key from that credential
  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.

About

Allows Alice to look up random images on Google Images

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages