File: uname.py

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 (40 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# This script sends "uname -a" output to current channel.
# 	Just type /uname while chatting on some channel ;)
#
# 		by Stalwart <stlwrt doggy gmail.com>
#
# port to WeeChat 0.3.0 by Benjamin Neff (SuperTux88) <info@benjaminneff.ch>
#
# Released under GPL licence.


SCRIPT_NAME    = "uname"
SCRIPT_AUTHOR  = "Stalwart <stlwrt doggy gmail.com>"
SCRIPT_VERSION = "1.1"
SCRIPT_LICENSE = "GPL2"
SCRIPT_DESC    = "Sends \"uname -a\" output to current channel"

import_ok = True

try:
    import weechat
except ImportError:
    print "This script must be run under WeeChat."
    print "Get WeeChat now at: http://www.weechat.org/"
    import_ok = False

try:
    from os import popen
except ImportError, message:
    print "Missing package(s) for %s: %s" % (SCRIPT_NAME, message)
    import_ok = False

def senduname(data, buffer, args):
	unameout = popen ('uname -a')
	uname = unameout.readline()
	weechat.command(buffer, "uname -a: " + uname[:-1])
	return weechat.WEECHAT_RC_OK

if __name__ == "__main__" and import_ok:
	if weechat.register(SCRIPT_NAME, SCRIPT_AUTHOR, SCRIPT_VERSION, SCRIPT_LICENSE, SCRIPT_DESC, "", ""):
		weechat.hook_command (SCRIPT_NAME, SCRIPT_DESC, '','Just type /uname while chatting on some channel ;)','', 'senduname', '')