| 1 | [ |
| 2 | "autonomous agent", |
| 3 | { |
| 4 | "init": "{ |
| 5 | |
| 6 | $nom_AA = 'Avisos'; |
| 7 | $versio = '1'; |
| 8 | |
| 9 | $AA_PF = trigger.data.AA_PF; |
| 10 | $adr__ = trigger.initial_address; |
| 11 | $args = trigger.data; |
| 12 | |
| 13 | $unitat = var[ $AA_PF ][ 'unitat' ]; |
| 14 | $AA_Capacitacions = var[ $AA_PF ][ '_AA_Capacitacions' ]; |
| 15 | |
| 16 | $adr = $args.adr; |
| 17 | $text = $args.text; |
| 18 | $rebot = $args.rebot; |
| 19 | $estat = $args.estat; |
| 20 | |
| 21 | if ( ! $adr ) { bounce ( $nom_AA || ': Cal proporcionar el valor de: adr' ); } |
| 22 | if ( ! $text ) { bounce ( $nom_AA || ': Cal proporcionar el valor de: text' ); } |
| 23 | if ( ! $rebot ) { bounce ( $nom_AA || ': Cal proporcionar el valor de: rebot' ); } |
| 24 | |
| 25 | |
| 26 | if ( ! var[ $AA_Capacitacions ][ 'Avisos_' || $adr__ ]) |
| 27 | { bounce ( $nom_AA || ': Adreça no capacitada per desar avisos' ); } |
| 28 | |
| 29 | }", |
| 30 | "messages": [ |
| 31 | { |
| 32 | "app": "state", |
| 33 | "state": "{ |
| 34 | var[ 'Avis_' || $adr ] = |
| 35 | { |
| 36 | actuant: $adr__, |
| 37 | text: $text, |
| 38 | rebot: $rebot, |
| 39 | data: timestamp, |
| 40 | estat: $estat, |
| 41 | }; |
| 42 | |
| 43 | response[ 'Avís' ] = $text; |
| 44 | response[ 'Rebot' ] = $rebot; |
| 45 | response[ 'Estat' ] = $estat; |
| 46 | }" |
| 47 | } |
| 48 | ] |
| 49 | } |
| 50 | ] |