コード例 #1
0
def on_game_message_received(game, notification):
    """ Manage notification GameMessageReceived..
        :param game: a Network game
        :param notification: notification received
        :type game: diplomacy.client.network_game.NetworkGame
        :type notification: diplomacy.communication.notifications.GameMessageReceived
    """
    Game.add_message(game, notification.message)
コード例 #2
0
def on_send_game_message(context, response):
    """ Manage response for request SendGameMessage.
        :param context: request context
        :param response: response received
        :return: None
        :type context: RequestFutureContext
        :type response: responses.DataTimeStamp
    """
    request = context.request  # type: requests.SendGameMessage
    message = request.message
    message.time_sent = response.data
    Game.add_message(context.game, message)