summaryrefslogtreecommitdiffstats
path: root/scripts/hello.py
diff options
context:
space:
mode:
authorChristopher Davis <loafier@gmail.com>2006-06-19 12:25:06 +0000
committerChristopher Davis <loafier@gmail.com>2006-06-19 12:25:06 +0000
commitbb48c914c6239ed1dbcb29eb62d33d3ab91e7215 (patch)
tree0b6910959f96f683f3aa11a8e2f53572e42b3305 /scripts/hello.py
parentefef73ae301947875602d67d0979a8ce3bd57dd0 (diff)
downloadirssi-python-bb48c914c6239ed1dbcb29eb62d33d3ab91e7215.tar.gz
irssi-python-bb48c914c6239ed1dbcb29eb62d33d3ab91e7215.tar.xz
irssi-python-bb48c914c6239ed1dbcb29eb62d33d3ab91e7215.zip
initial import
git-svn-id: http://svn.irssi.org/repos/irssi-python@4282 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'scripts/hello.py')
-rw-r--r--scripts/hello.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/hello.py b/scripts/hello.py
new file mode 100644
index 0000000..fd5a814
--- /dev/null
+++ b/scripts/hello.py
@@ -0,0 +1,20 @@
+# type /pyload hello
+
+import irssi
+
+# data - contains the parameters for /HELLO
+# server - the active server in window
+# witem - the active window item (eg. channel, query)
+# or None if the window is empty
+def cmd_hello(data, server, witem):
+ if not server or not server.connected:
+ irssi.prnt("Not connected to server")
+
+ if data:
+ server.command("MSG %s Hello!" % data)
+ elif isinstance(witem, irssi.Channel) or isinstance(witem, irssi.Query):
+ witem.command("MSG %s Hello!" % witem.name)
+ else:
+ irssi.prnt("Nick not given, and no active channel/query in window")
+
+irssi.command_bind('hello', cmd_hello)