* added script handler "_onchatmessage" that gets triggered when ANY chat message is recieved. * TODO: finish & debug "processchatai" and "registerchataiscript" scripts.
33 lines
929 B
Modula-2
33 lines
929 B
Modula-2
// example script that registers itself to get called on incoming chat messages.
|
|
// args passed to this script are as follows:
|
|
// @def: chat msg
|
|
// @0: message type
|
|
// @1: lang id
|
|
// @2: guid of sender
|
|
// @3: channel name
|
|
// @4: language name
|
|
|
|
#onload
|
|
// call us only if somebody says a text containing "hello" and "world"
|
|
RegisterChatAIScript,chat_ai_helloworld,EXACT hello world
|
|
#/onload
|
|
|
|
// ---------------------------------------
|
|
#script=chat_ai_helloworld
|
|
// ---------------------------------------
|
|
if ?{equal,${@0} 0}
|
|
// say some stuff is the language that was used by the sender
|
|
say,${@1} Hello World! This is an example!
|
|
else
|
|
// else shout back in our default language
|
|
if ?{equal,${@0} 5}
|
|
yell Yah "Hello World!" is widely used to proof that something is working!!
|
|
else
|
|
if ?{equal,${@0} 14}
|
|
chan,{${@3}} Recieved a nice "Hello World" in channel ${@3} ;)
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
|