Respond to RP postMessage
195885
function respondToRPMessage (event) {
    var parser, messenger, clientId, rpss,
      salt, opbs, input, opss, comparison

    // Parse message origin
    origin = event.origin
    parser = document.createElement('a')
    parser.href = document.referrer
    messenger = parser.protocol + '//' + parser.host

    // Ignore the message if origin doesn't match
    if (origin !== messenger) {
      return
    }

    // get a reference to the source so we can message it
    // immediately in response to a change in sessionState
    source = event.source

    // Parse the message
    clientId = event.data.split(' ')[0]
    rpss = event.data.split(' ')[1]
    salt = rpss.split('.')[1]

    // Validate message syntax
    if (!clientId || !rpss || !salt) {
      event.source.postMessage('error', origin)
    }

    // Get the OP browser state
    opbs = getOPBrowserState()

    // Recalculate session state for comparison
    input = [clientId, origin, opbs, salt].join(' ')
    opss = [CryptoJS.SHA256(input), salt].join('.')

    // Compare the RP session state with the OP session state
    comparison = compareSessionState(rpss, opss)

    // Compare session state and reply to RP
    event.source.postMessage(comparison, origin)
  }
532944
async def respond(self, *args, **kwargs):
        
        return await self._client.send_message(
            await self.get_input_chat(), *args, **kwargs)
1084045
public static RpcResponse rpcResponse(Status status, @Nullable Object message) {
        if (status.isOk()) {
            return RpcResponse.of(message);
        } else {
            return RpcResponse.ofFailure(status.asException());
        }
    }
1281032
def ask(message, options):
    """"""
    while 1:
        if os.environ.get('PIP_NO_INPUT'):
            raise Exception('No input was expected ($PIP_NO_INPUT set); question: %s' % message)
        response = raw_input(message)
        response = response.strip().lower()
        if response not in options:
            print('Your response (%r) was not one of the expected responses: %s' % (
                response, ', '.join(options)))
        else:
            return response
877845
def reply(self, message):
        
        if self.sessionActive:
            return self._gsmModem.sendUssd(message)
        else:
            raise InvalidStateException('USSD session is inactive')
714252
def post_message(params)
      self.class.post('/chat.postMessage', body: params.merge({token: @token})).tap do |response|
        raise "error posting message: #{response.fetch('error', 'unknown error')}" unless response['ok']
      end
    end
779181
def reply_to_request(self, req, rep):
        

        assert isinstance(req, EventRequestBase)
        assert isinstance(rep, EventReplyBase)
        rep.dst = req.src
        if req.sync:
            req.reply_q.put(rep)
        else:
            self.send_event(rep.dst, rep)
992205
def send(r, pools=None):
    """"""

    if pools:
        r._pools = pools

    r.send()

    return r.response
583731
function(postmessage) {
			var data = postmessage, action, root, handlers;
			if(gui.Type.isString(data) && data.startsWith("spiritual-action:")) {
				action = gui.Action.parse(data);
				if (action.direction === gui.Action.DESCEND) {
					// Hotfix for actions in nospirit scenario
					// TODO: rething this pending WeakMaps...
					if((handlers = this._globals[action.type])) {
						handlers.slice().forEach(function(handler) {
							handler.onaction(action);
						});
					}
					if(gui.hasModule('gui-spirits@wunderbyte.com')) {
						if ((root = gui.get('html'))) {
							root.action.$handleownaction = true;
							root.action.descendGlobal(
								action.type,
								action.data
							);
						}
					}
				}
			}
		}
437480
function sendMessage(client, to, message, callback) {
	resolveID(client, to, function(channelID) {
		client._req('post', Endpoints.MESSAGES(channelID), message, function(err, res) {
			handleResCB("Unable to send messages", err, res, callback);
		});
	});
}
1296377
def on_recv_rsp(self, rsp_pb):
        """"""
        ret_code, msg, _= SubAccPush.unpack_rsp(rsp_pb)

        if self._notify_obj is not None:
            self._notify_obj.on_async_sub_acc_push(ret_code, msg)

        return ret_code, msg
897285
def post_message2(consumers, lti_key, url, body,
                  method='POST', content_type='application/xml'):
    
    # pylint: disable=too-many-arguments
    (response, _) = _post_patched_request(
        consumers,
        lti_key,
        body,
        url,
        method,
        content_type,
    )

    is_success = response.status == 200
    log.debug("is success %s", is_success)

    return is_success
1083678
function(message) {
			if (that.listeners(message.verb).length) {
				var successHandler = function(msg) {
					reply(proto.writeInit(msg.id));
				};
				var errorHandler = function(msg, exceptionMessage, exceptionType) {
					reply(proto.writeInitException(msg.id, exceptionMessage, exceptionType));
				};
				var response = new DataResponse(message, successHandler, errorHandler);
				that.emit("init", message, response);
			} else {
				reply(proto.writeInit(message.id));
			}
		}
585893
def rpc_reply(id: Union[str, int], result: Optional[object],
              warnings: Optional[List[Warning]] = None) -> rpcq.messages.RPCReply:
    
    warnings = warnings or []

    return rpcq.messages.RPCReply(
        jsonrpc='2.0',
        id=id,
        result=result,
        warnings=[rpc_warning(warning) for warning in warnings]
    )
665816
public void reply(Object message) {
        if (context.sender() != null) {
            context.sender().send(message, self());
        }
    }
695672
def reply(self, text):
        
        data = {'text': text, 'vchannel_id': self['vchannel_id']}
        if self.is_p2p():
            data['type'] = RTMMessageType.P2PMessage
            data['to_uid'] = self['uid']
        else:
            data['type'] = RTMMessageType.ChannelMessage
            data['channel_id'] = self['channel_id']
        return RTMMessage(data)
491211
async def on_message(message):
    

    # Simplify message info
    server = message.server
    author = message.author
    channel = message.channel
    content = message.content

    data = datatools.get_data()

    if not data["discord"]["servers"][server.id][_data.modulename]["activated"]:
        return

    # Only reply to server messages and don't reply to myself
    if server is not None and author != channel.server.me:
        # Commands section
        prefix = data["discord"]["servers"][server.id]["prefix"]
        if content.startswith(prefix):
            # Parse message
            package = content.split(" ")
            command = package[0][len(prefix):]
            args = package[1:]

            alias_steam = ["steam", "pc"]
            alias_ps = ["ps", "psn", "playstation", "ps4", "playstation 4"]
            alias_xbox = ["xbox", "xb", "xb1", "xbone", "xbox one", "xbox one"]

            platform = "steam"
            if len(args) > 0:
                player_name = args[0]
            else:
                return

            if len(args) > 1:
                platform = ' '.join(args[1:]).lower()

            if platform in alias_steam:
                platform = "steam"
            elif platform in alias_ps:
                platform = "ps"
            elif platform in alias_xbox:
                platform = "xbox"

            # Commands
            if command == 'rlstats':
                await client.send_typing(channel)

                # Get Rocket League stats from stats API
                success, rldata = api_rocketleaguestats.check_rank(player_name, platform)
                # Create embed UI
                if success:
                    embed = ui_embed.success(channel, rldata[0], rldata[1], rldata[2], rldata[3])
                else:
                    embed = ui_embed.fail_api(channel)

                await embed.send()