X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ftwitter.rb;h=a5ca23f87a16ae1d6e1b8ba0fdc1b93d0c578ec7;hb=22e6cefa54de681b131ecb97fc9383ff5e990dfe;hp=0ac88ef76bfe727885ae3010d1be8902e90a1f14;hpb=e999932b5e4971febc4aa2f255b907e2fc9cefaf;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/twitter.rb b/data/rbot/plugins/twitter.rb index 0ac88ef7..a5ca23f8 100644 --- a/data/rbot/plugins/twitter.rb +++ b/data/rbot/plugins/twitter.rb @@ -136,10 +136,11 @@ class TwitterPlugin < Plugin response = @bot.httputil.post(uri, body, :headers => @header) debug response + reply_method = params[:notify] ? :notify : :reply if response.class == Net::HTTPOK - m.reply "status updated" + m.__send__(reply_method, "status updated") else - m.reply "could not update status" + m.__send__(reply_method, "could not update status") end end @@ -154,7 +155,7 @@ class TwitterPlugin < Plugin def ctcp_listen(m) return unless m.action? return unless @registry[m.sourcenick + "_actions"] - update_status(m, :status => m.message) + update_status(m, :status => m.message, :notify => true) end # show or toggle action twitting @@ -164,7 +165,7 @@ class TwitterPlugin < Plugin @registry[m.sourcenick + "_actions"] = true m.okay when 'off' - @registry[m.sourcenick + "_actions"] = false + @registry.delete(m.sourcenick + "_actions") m.okay else if @registry[m.sourcenick + "_actions"]