XchatPyScriptSamples
Jump to navigation
Jump to search
normally the best to get started is to play a bit around with a simple script and alter it ..
a barebone structure of a xchat python script could be:
|
a nice way to test interactively the commands you want afterwards use in the script
is to place them in the input field /py exec <pythonCommand>
as example:
/py exec import xchat
/py exec xchat.prnt("tst")
to print from the script to another tab (as example to summary) is to use the context paradigm where the context needs to exist
in the previous prnt example the "current context" was returned by xchat.
/py exec xchat.command("query summary")
/py exec myContext = xchat.find_context(channel='summary')
/py exec myContext.prnt("tst")
(in the days before xchat2 there existed a perl method IRC::print_on_channel() that got now a much more general/nicer replacement with the context paradigm)