X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ftime.rb;h=4e7543c8be2317a0f6fc78f191602509985c4d0f;hb=2e33012eb5eb8cf121059d06f07f6950141deccc;hp=9f8b8d7cb05bbd045d40314a843882f7b5517df7;hpb=b2d2ceb4f15c215b506fd6d36a09f6487ec46772;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/time.rb b/data/rbot/plugins/time.rb index 9f8b8d7c..4e7543c8 100644 --- a/data/rbot/plugins/time.rb +++ b/data/rbot/plugins/time.rb @@ -1,6 +1,11 @@ -# Time Zone Plugin for rbot -# (c) 2006 Ian Monroe -# Licensed under MIT License. +#-- vim:sw=2:et +#++ +# +# :title: Time Zone Plugin for rbot +# +# Author:: Ian Monroe +# Copyright:: (C) 2006 Ian Monroe +# License:: MIT license require 'tzinfo' @@ -47,18 +52,19 @@ class TimePlugin < Plugin zone = arr.join( sp ) } - TZInfo::Timezone.get( zone ).now + tz = TZInfo::Timezone.get( zone ) + "#{tz.friendly_identifier} - #{tz.now.strftime( '%a %b %d %H:%M' )} #{tz.current_period.abbreviation}" end def showTime(m, params) zone = params[:where].join('_') if params[:where].size > 0 then begin - m.reply "#{zone} - #{getTime( m, zone )}" + m.reply getTime( m, zone ) rescue TZInfo::InvalidTimezoneIdentifier if @registry.has_key?( zone ) then zone = @registry[ zone ] - m.reply "#{zone} - #{getTime( m, zone )}" + m.reply getTime( m, zone ) else m.reply "#{zone} is an unknown time." end @@ -66,7 +72,7 @@ class TimePlugin < Plugin else if @registry.has_key?( m.sourcenick) then zone = @registry[ m.sourcenick ] - m.reply "#{m.sourcenick}: #{zone} - #{getTime( m, zone )}" + m.reply "#{m.sourcenick}: #{getTime( m, zone )}" else m.reply "#{m.sourcenick}: use time set to set your timezone." end