diff --git a/exec/load/ircbot_functions.js b/exec/load/ircbot_functions.js
index e903c823df9e324db47e3ed5bc809e500462f67b..3b204b7dbc15558c4f203dfe8eebe1e78996f9fe 100644
--- a/exec/load/ircbot_functions.js
+++ b/exec/load/ircbot_functions.js
@@ -284,12 +284,16 @@ function Server_writeout(str) {
 	this.sock.write(str.slice(0, 512) + "\r\n");
 }
 
-function Server_target_out(target,str) {
+function Server_target_out(target,str,msgtype) {
 	for (c in squelch_list) {
 		if (target.toUpperCase() == squelch_list[c].toUpperCase())
 			return;
 	}
-	var outstr = "PRIVMSG " + target + " :" + str;
+
+	if (!msgtype)
+		msgtype = "PRIVMSG";
+
+	var outstr = msgtype + " " + target + " :" + str;
 	log("--> " + this.host + ": " + outstr);
 	this.sock.write(outstr.slice(0, 512) + "\r\n");
 }