Relay chat messages to and from clients.
953
def chat(ws):
    
    lag_tolerance_secs = float(request.args.get("tolerance", 0.1))
    client = Client(ws, lag_tolerance_secs=lag_tolerance_secs)
    client.subscribe(request.args.get("channel"))
    gevent.spawn(client.heartbeat)
    client.publish()
1214199
def chat(self, message):
    """"""
    if message:
      action_chat = sc_pb.ActionChat(
          channel=sc_pb.ActionChat.Broadcast, message=message)
      action = sc_pb.Action(action_chat=action_chat)
      return self.act(action)
357421
def on_message(self, message_id_service, contact_id_service, content):
        
        try:
            live_chat = Chat.live.get(
                Q(agent__id_service=contact_id_service) | Q(asker__id_service=contact_id_service))            
        except ObjectDoesNotExist:
            self._new_chat_processing(message_id_service, contact_id_service, content)
        else:
            live_chat.handle_message(message_id_service, contact_id_service, content, self)
94887
def _parse_lobby_chat(self, messages, source, timestamp):
        """"""
        for message in messages:
            if message.message_length == 0:
                continue
            chat = ChatMessage(message.message, timestamp, self._players(), source=source)
            self._parse_chat(chat)
1316410
def send_chat_messages(self, messages):
    """"""
    self._parallel.run(
        (c.chat, message) for c, message in zip(self._controllers, messages))
637780
def forwardMessage(self, chat_id, from_chat_id, message_id,
                       disable_notification=None):
        
        p = _strip(locals())
        return self._api_request('forwardMessage', _rectify(p))
1317120
def on_message(self, client, userdata, msg):
        '''
        
        '''
        if msg.topic == 'serial_device/refresh_comports':
            self.refresh_comports()
            return

        match = CRE_MANAGER.match(msg.topic)
        if match is None:
            logger.debug('Topic NOT matched: `%s`', msg.topic)
        else:
            logger.debug('Topic matched: `%s`', msg.topic)
            # Message topic matches command.  Handle request.
            command = match.group('command')
            port = match.group('port')

            #     serial_device/<port>/send   # Bytes to send
            if command == 'send':
                self._serial_send(port, msg.payload)
            elif command == 'connect':
                # serial_device/<port>/connect  # Request connection
                try:
                    request = json.loads(msg.payload)
                except ValueError as exception:
                    logger.error('Error decoding "%s (%s)" request: %s',
                                 command, port, exception)
                    return
                self._serial_connect(port, request)
            elif command == 'close':
                self._serial_close(port)
1231335
def __on_message(self, connection, sender, message):
        
        if message.strip() == '!bot send':
            cycle = itertools.cycle(string.digits)
            content = ''.join(next(cycle) for _ in range(100))
            self.send_message(sender, content)

        else:
            parts = message.split(':', 2)
            if not parts or parts[0] != 'HRLD':
                return

            if parts[1] == 'BEGIN':
                # Beginning of multi-line message
                self._queue[parts[2]] = []

            elif parts[1] == 'END':
                # End of multi-line message
                content = ''.join(self._queue.pop(parts[2]))
                self.__notify(sender, content)

            elif parts[1] == 'MSG':
                # Single-line message
                content = parts[2]
                self.__notify(sender, content)

            else:
                # Multi-line message continuation
                uid = parts[1]
                self._queue[uid].append(parts[2])
295520
function sendMessage(messageText) {
    var content = {
      type: chatMessageType,
      root: rootMessageId
    };

    if ( !isPublic && (!participants || participants.length === 0) ) {
      console.error("Chatbox: participants array must be configured or the chat must be configured as public.")
      return;
    }

    content[chatMessageField] = messageText;

    if (isPublic) {
      sbot.publish(content, (err, msg) => {
        if (err) {
          console.log("Error publishing public chat message " + err);
        }

      })
    } else {
      sbot.private.publish(content, participants, (err, msg) => {
        if (err) {
          console.log("Error publishing private chat message " + err);
        }
      });
    }
  }
1081216
function sendMsg(that) {
        var msg, to, ids;

        // No msg sent.
        if (that.isDisabled()) return;

        msg = that.readTextarea();

        // Move cursor at the beginning.
        if (msg === '') {
            node.warn('Chat: message has no text, not sent.');
            return;
        }
        // Simplify things, if there is only one recipient.
        ids = that.recipientsIds;
        if (ids.length === 0) {
            node.warn('Chat: empty recipient list, message not sent.');
            return;
        }
        to = ids.length === 1 ? ids[0] : ids;
        that.writeMsg('outgoing', { msg: msg }); // to not used now.
        node.say(that.chatEvent, to, msg);
        // Make sure the cursor goes back to top.
        setTimeout(function() { that.textarea.value = ''; });
    }
778229
def from_message(bot, message):
        
        chat = message["chat"]
        return Chat(bot, chat["id"], chat["type"], message)
1282803
def send_chat_action(self, peer: Peer, action: botapi.ChatAction, on_success: callable=None):
        
        botapi.send_chat_action(chat_id=peer.id, action=action, on_success=on_success, **self.request_args).run()
500387
function Communication() {
		// setup abstract layer
		core.CommunicationAbstract.apply(this, arguments);

		// just relay message object they do not need to be parsed
		this.object.on('message', this.emit.bind(this, 'message'));

		// when the remote request a method, the methods should exists in .handlers
		var self = this;
		this.handlers.close = function () {
			this.callback();
			self.emit('close');
		};
	}
800106
async def join(self, ctx):
        """"""
        perms = discord.Permissions.none()
        perms.read_messages = True
        perms.send_messages = True
        perms.manage_messages = True
        perms.embed_links = True
        perms.read_message_history = True
        perms.attach_files = True
        perms.add_reactions = True
        await self.bot.send_message(ctx.message.author, discord.utils.oauth_url(self.bot.client_id, perms))
532944
async def respond(self, *args, **kwargs):
        
        return await self._client.send_message(
            await self.get_input_chat(), *args, **kwargs)
84436
def send_ClientCutText(self, message):
        
        self.sendMessage(struct.pack("!BxxxI", 6, len(message)))
        self.sendMessage(message)
1098752
def chat(client):
    
    global SERVER_RUN
    msg = client.get_command()
    print '%s says, "%s"' % (client.addrport(), msg)

    for guest in CLIENT_LIST:
        if guest != client:
            guest.send('%s says, %s\n' % (client.addrport(), msg))
        else:
            guest.send('You say, %s\n' % msg)

    cmd = msg.lower()
    ## bye = disconnect
    if cmd == 'bye':
        client.active = False
    ## shutdown == stop the server
    elif cmd == 'shutdown':
        SERVER_RUN = False