File: myuptime.rb

package info (click to toggle)
weechat-scripts 20180330-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,072 kB
  • sloc: python: 44,904; perl: 27,389; ruby: 2,101; lisp: 339; tcl: 244; sh: 8; makefile: 7
file content (22 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# ==================================================================================================
#  myuptime.rb (c) April 2006 by David DEMONCHY (fusco) <fusco.spv@gmail.com>
#
#  port to WeeChat 0.3.0 by Benjamin Neff (SuperTux88) <info@benjaminneff.ch>
#
#  Licence     : GPL v2
#  Description : Sends machine uptime to current channel
#  Syntax      : /myuptime
#    => uptime  <hostname> :  00:16:58 up 11:09,  4 users,  load average: 0.05, 0.21, 0.29 
#
# ==================================================================================================

def weechat_init
	Weechat.register('myuptime', 'David DEMONCHY (fusco) <fusco.spv@gmail.com>', '0.2', 'GPL2', 'Sends machine uptime to current channel', '', '')
	Weechat.hook_command('myuptime', 'Sends machine uptime to current channel', '', '', '', 'myuptime', '')
	return Weechat::WEECHAT_RC_OK
end

def myuptime(data, buffer, args)
	Weechat.command(buffer, "uptime "+ `hostname`.chomp + ":"  + `uptime`.chomp)
	return Weechat::WEECHAT_RC_OK
end