Sha256: 5be029f4ab05b97256dab6d458a53fa66006f65bd70633ef0d07d28238cd89f9
Contents?: true
Size: 598 Bytes
Versions: 1
Compression:
Stored size: 598 Bytes
Contents
# frozen_string_literal: true module Waylon module Skills # Lets Waylon tell some jokes class Jokes < Waylon::Skill route( /^(tell me a )?joke$/i, :tell_a_joke, help: { usage: "[tell me a] joke", description: 'Tells a "dad" joke' } ) def tell_a_joke conn = Faraday.new(headers: { accept: "application/json" }) do |f| f.request :retry f.response :json end response = conn.get("https://icanhazdadjoke.com/") reply(response.body["joke"]) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
waylon-jokes-0.1.0 | lib/waylon/skills/jokes.rb |