eg/reply-async/weatherman.js
function(onReady) {
	var self = this;

	if (APPID === 'change me') {
		console.log('Error -- edit weatherman.js and provide the APPID for Open Weathermap.'.bold.yellow);
	}

	// Load the replies and process them.
	rs.loadFile("weatherman.rive").then(function() {
		rs.sortReplies();
		onReady();
	}).catch(function(err) {
		console.error(err);
	});

	// This is a function for delivering the message to a user. Its actual
	// implementation could vary; for example if you were writing an IRC chatbot
	// this message could deliver a private message to a target username.
	self.sendMessage = function(username, message) {
		// This just logs it to the console like "[Bot] @username: message"
		console.log(
			["[Brick Tamland]", message].join(": ").underline.green
		);
	};

	// This is a function for a user requesting a reply. It just proxies through
	// to RiveScript.
	self.getReply = function(username, message, callback) {
		return rs.reply(username, message, self);
	}
}
function(onReady) {
	var self = this;

	if (APPID === 'change me') {
		console.log('Error -- edit weatherman.js and provide the APPID for Open Weathermap.'.bold.yellow);
	}

	// Load the replies and process them.
	rs.loadFile("weatherman.rive").then(function() {
		rs.sortReplies();
		onReady();
	}).catch(function(err) {
		console.error(err);
	});

	// This is a function for delivering the message to a user. Its actual
	// implementation could vary; for example if you were writing an IRC chatbot
	// this message could deliver a private message to a target username.
	self.sendMessage = function(username, message) {
		// This just logs it to the console like "[Bot] @username: message"
		console.log(
			["[Brick Tamland]", message].join(": ").underline.green
		);
	};

	// This is a function for a user requesting a reply. It just proxies through
	// to RiveScript.
	self.getReply = function(username, message, callback) {
		return rs.reply(username, message, self);
	}
}
function ( onReady ) { var self = this ; if ( APPID === 'change me' ) { console . log ( 'Error -- edit weatherman.js and provide the APPID for Open Weathermap.' . bold . yellow ) ; } // Load the replies and process them. rs . loadFile ( "weatherman.rive" ) . then ( function ( ) { rs . sortReplies ( ) ; onReady ( ) ; } ) . catch ( function ( err ) { console . error ( err ) ; } ) ; // This is a function for delivering the message to a user. Its actual // implementation could vary; for example if you were writing an IRC chatbot // this message could deliver a private message to a target username. self . sendMessage = function ( username , message ) { // This just logs it to the console like "[Bot] @username: message" console . log ( [ "[Brick Tamland]" , message ] . join ( ": " ) . underline . green ) ; } ; // This is a function for a user requesting a reply. It just proxies through // to RiveScript. self . getReply = function ( username , message , callback ) { return rs . reply ( username , message , self ) ; } }
Create a prototypical class for our own chatbot.
Create a prototypical class for our own chatbot .