X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Ftime.rb;h=190abd6acdcde59f4f645f8300c452f2f8d5b5de;hb=16336b4a240a4265d1f2df1e30d7b68d3a924287;hp=96b101ce68e32f95f6701f42da545afbee5deb48;hpb=edd1cf77be07ae507014574141e920ad23eb164d;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/time.rb b/data/rbot/plugins/time.rb index 96b101ce..190abd6a 100644 --- a/data/rbot/plugins/time.rb +++ b/data/rbot/plugins/time.rb @@ -45,25 +45,26 @@ class TimePlugin < Plugin end ['/', '_'].each { |sp| arr = Array.new - zone.split(sp).each{ |s| + zone.split(sp).each{ |s| s[0] = s[0,1].upcase s[1, s.length] = s[1, s.length].downcase if sp == '/' arr.push(s) } 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 @@ -71,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