File: myuptime.rb

package info (click to toggle)
weechat-scripts 20221022-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,688 kB
  • sloc: python: 42,639; perl: 24,814; ruby: 2,261; lisp: 338; tcl: 244; javascript: 138; makefile: 14; sh: 9
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