btnexus-integration-python.btIntegration module¶
Blackout Nexus node. Base class for all personality core parts
-
class
btIntegration.Integration(connectHash=None, rcPath=None, personalityId=None, settingsPath=None)[source]¶ Bases:
objectThis class provides all important endpoints which are needed to implement an Integration for the btNexus.
This class provides all important endpoints which are needed to implement an Integration for the btNexus.
- Parameters
connectHash (String) – the connectHash - This must almost never be set! The connectHash is extracted automatically from the environment variable CONNECT_HASH or the .btnexusrc file
rcPath (String) – Path to your .btnexusrc file. If not set it is assumed, that it is in the working directory
personalityId (String) – The PersonalityId - This must almost never be set! The PersonalityId is automatically extracted from the environment variable PERSONALITY_ID (You should use it the same way while development to ensure it works in production)
settingsPath (String) – Path to your settings.json file. If not set it is assumed, that it is in the working directory
-
authenticateSession(callback=None, errBack=None, callbackArgs=None, **kwargs)[source]¶ authenticate the session for calls to chat. This should be called everytime a new session starts. If not called explicitly it will be called by chat.
- Parameters
callback (function pointer) – the callback which handles the response
errBack (function pointer) – callback to handle errors that prevent that the response can be handled by the callback. takes one argument which is the exception - This is needed for the threaded send() otherwise exceptions can’t be handled
callbackArgs (list) – list of additional args for the callback (The list will be unpacked)
-
chat(text, language, actionSource=None, callback=None, errBack=None, callbackArgs=None, **kwargs)[source]¶ Call to the chat endpoint.
- Parameters
text (String) – the text request to the Personality
language (String) – the language for the request in ISO 3166-1 alpha-2 (Example: ‘en-US’ or ‘de-DE’)
actionSource (String) – Source for the action(used for buttons)
callback (function pointer) – the callback which handles the response
errBack (function pointer) – callback to handle errors that prevent that the response can be handled by the callback. takes one argument which is the exception - This is needed for the threaded send() otherwise exceptions can’t be handled
callbackArgs (list) – list of additional args for the callback (The list will be unpacked)
-
getChatBehavior(language, behavior, callback=None, errBack=None, callbackArgs=None, **kwargs)[source]¶ Call to the chatBehavior endpoint.
- Parameters
language (String) – the language for the request in ISO 3166-1 alpha-2 (Example: ‘en-US’ or ‘de-DE’)
behavior (String) – One out of engage-welcome, engage-greeting, disengage-goodbye, reaction-dunno, reaction-pet, reaction-named, error-offline, error-unknown-language, error-fatal, action-bored
callback (function pointer) – the callback which handles the response
errBack (function pointer) – callback to handle errors that prevent that the response can be handled by the callback. takes one argument which is the exception - This is needed for the threaded send() otherwise exceptions can’t be handled
callbackArgs (list) – list of additional args for the callback (The list will be unpacked)
-
getPersonalityProfile(language, callback=None, errBack=None, callbackArgs=None, **kwargs)[source]¶ Call to the personalityProfile endpoint.
- Parameters
language (String) – the language for the request in ISO 3166-1 alpha-2 (Example: ‘en-US’ or ‘de-DE’)
callback (function pointer) – the callback which handles the response
errBack (function pointer) – callback to handle errors that prevent that the response can be handled by the callback. takes one argument which is the exception - This is needed for the threaded send() otherwise exceptions can’t be handled
callbackArgs (list) – list of additional args for the callback (The list will be unpacked)
-
getSettings(language, callback=None, errBack=None, callbackArgs=None, **kwargs)[source]¶ Call to get settings. sets the settings in self.settings and calls the callback with this dict. If no settings are available from the personality the default values from the settings.json file are taken and a warning is raised.
- Parameters
language (String) – the language for the request in ISO 3166-1 alpha-2 (Example: ‘en-US’ or ‘de-DE’)
callback (function pointer) – the callback which handles the response
errBack (function pointer) – callback to handle errors that prevent that the response can be handled by the callback. takes one argument which is the exception - This is needed for the threaded send() otherwise exceptions can’t be handled
callbackArgs (list) – list of additional args for the callback (The list will be unpacked)