btnexus-node-python.btHook module¶
Blackout Nexus hook. Base class for all hooks
-
class
btHook.
Hook
(connectHash=None, **kwargs)[source]¶ Bases:
btNode.Node
Blackout Nexus hook. Base class for all hooks
Constructor for the hook. extracting all important infos from the connectHash (either given as parameter, via environment variable CONNECT_HASH or in the .btnexusrc(prioritized in this order))
-
getCaption
(lang, key)[source]¶ Returns a phrase from the captions file. If a list of phrases is given in the captions file one is chosen randomly. If only a String is given it returns this.
- Parameters
lang (String) – the requested language
key (String) – key for a specific phrase
-
load
(key, callback=None)[source]¶ load a value to a specific key in the NexusData Api
- Parameters
key (String) – the key to which the value should be saved
callback (function pointer) – callback to handle the api response
-
onInit
(**kwargs)[source]¶ Initilize what you need before the hook connected - you can pass kwargs in the constructor to use them here
-
onMessage
(originalTxt, intent, language, entities, slots, branchName, peer)[source]¶ Overload for your custum hook! - it needs to trigger say
React on a message forwarded to the hook.
- Parameters
originalTxt (String) – the original text
intent (String) – the classified intent
language (String) – the (classified) language
entities (List of (String)) – List of used entities
slots (List of (String)) – List of used slots
branchName (String) – Name of the Branch
peer (dict) – param to indentify message origin
-
onReady
(**kwargs)[source]¶ Initilize what you need after the hook connected - you can pass kwargs in the constructor to use them here
-
put
(key, value, callback=None)[source]¶ add a value to a specific key in the NexusData Api - the value must be a list otherwise it will be overwritten
- Parameters
key (String) – the key to which the value should be saved
value (Object) – the object which should be saved
callback (function pointer) – callback to handle the api response
-
save
(key, value, callback=None)[source]¶ save a value to a specific key in the NexusData Api
- Parameters
key (String) – the key to which the value should be saved
value (Object) – the object which should be saved
callback (function pointer) – callback to handle the api response
-