(self, socket_id: Text, response: Any)
Sends a message to the recipient using the bot event.
Sends a message to the recipient using the bot event.
Sends a message to the recipient using the bot event .
async def _send_message(self, socket_id: Text, response: Any) -> None:
        """Sends a message to the recipient using the bot event."""

        if response.get("text"):
          q = {
            'text': response['text']
          }
          if self.botium_speech_voice:
            q['voice'] = self.botium_speech_voice

          audioEndpoint = f"{self.botium_speech_url}/api/tts/{self.botium_speech_language}?{urlencode(q)}"
          audio = urlopen(audioEndpoint).read()
          logger.debug(f"_send_message- Calling Speech Endpoint: {audioEndpoint}")

          audioBase64 = base64.b64encode(audio).decode('ascii')
          audioUri = "data:audio/wav;base64," + audioBase64
          response['link'] = audioUri

        await self.sio.emit(self.bot_message_evt, response, room=socket_id)
async def _send_message ( self , socket_id : Text , response : Any ) -> None : if response . get ( "text" ) : q = { 'text' : response [ 'text' ] } if self . botium_speech_voice : q [ 'voice' ] = self . botium_speech_voice audioEndpoint = f"{self.botium_speech_url}/api/tts/{self.botium_speech_language}?{urlencode(q)}" audio = urlopen ( audioEndpoint ) . read ( ) logger . debug ( f"_send_message- Calling Speech Endpoint: {audioEndpoint}" ) audioBase64 = base64 . b64encode ( audio ) . decode ( 'ascii' ) audioUri = "data:audio/wav;base64," + audioBase64 response [ 'link' ] = audioUri await self . sio . emit ( self . bot_message_evt , response , room = socket_id )