'bytesize' error with httputil.rb
Opened this issue · 0 comments
IotaSpencer commented
Traceback
E, [2016/06/04 10:33:55#46631] ERROR -- httputil.rb:692:in `rescue in post': #<RuntimeError: undefined method `bytesize' for #<Hash:0x007f626a3843d8>
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/core/utils/httputil.rb:637:in `rescue in get_response'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/core/utils/httputil.rb:607:in `get_response'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/core/utils/httputil.rb:688:in `post'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/.rbot/plugins/ecodemisc.rb:39:in `passgen'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/messagemapper.rb:281:in `block in handle'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/messagemapper.rb:247:in `each'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/messagemapper.rb:247:in `handle'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/plugins.rb:232:in `handle'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/plugins.rb:269:in `privmsg'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/plugins.rb:1075:in `privmsg'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/plugins.rb:1102:in `irc_delegate'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/ircbot.rb:682:in `block in initialize'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/rfc2812.rb:1527:in `handle'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/rfc2812.rb:1422:in `process'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/lib/rbot/ircbot.rb:1063:in `mainloop'
E, [2016/06/04 10:33:55#46631] ERROR -- : /home/ken/rbot/rbot/bin/rbot:120:in `<top (required)>'
E, [2016/06/04 10:33:55#46631] ERROR -- : ./launch_here.rb:68:in `load'
E, [2016/06/04 10:33:55#46631] ERROR -- : ./launch_here.rb:68:in `<main>'>
nil
My Code
#-- vim:sw=2:et
#++
#
# :title: ElectroCode Misc Commands
#
# Author:: Ken Spencer <iota@electrocode.net>
#
# Copyright:: (C) 2016 Ken Spencer
#
# License:: public domain
#
# TODO to do stuff
require 'httparty'
class Partay
include HTTParty
base_uri 'http://scripts.electrocode.net'
end
class EcodePlugin < Plugin
def help(plugin, topic="")
[
_("passgen <length> <uppercase> <lowercase> <numerics> <no ambiguous> => generate a password with the given options"),
_("getbot <channel> <bot> => get a command for a bot")
].join(", ")
end
def passgen(m, params)
options = {
:length => params[:length],
:upper => params[:upper],
:lower => params[:lower],
:numerics => params[:numerics],
:ambi => params[:ambi],
:raw => true
}
reply = @bot.httputil.post('http://scripts.electrocode.net/random', options)
pp reply # => returns nil -- it seems
m.reply reply
end
end
plugin = EcodePlugin.new
plugin.map "passgen [:length] [:upper] [:lower] [:numerics] [:ambi]",
:defaults => {:length => 10, :upper => true, :lower => true, :numerics => true, :ambi => true}
plugin.map "getbot [:channel] [:bot]"