diff --git a/lib/channel.js b/lib/channel.js
index 1be710f4..34c0e156 100644
--- a/lib/channel.js
+++ b/lib/channel.js
@@ -270,7 +270,7 @@ Channel.prototype.loadState = function () {
// Emotes
if ("emotes" in data) {
data.emotes.forEach(function (e) {
- self.emotes.push(e);
+ self.updateEmote(e);
});
}
@@ -2505,7 +2505,7 @@ Channel.prototype.validateEmote = function (f) {
var s = f.name.replace(/\\\.\?\+\*\$\^\(\)\[\]\{\}/g, "\\$1");
s = s.replace(/&/g, "&").replace(//g, ">");
- s = "(^|\\b)" + s + "($|\\b)";
+ s = "(^|\\s)" + s + "($|\\s)";
f.source = s;
try {
diff --git a/www/assets/js/util.js b/www/assets/js/util.js
index d3ec2aba..d2854510 100644
--- a/www/assets/js/util.js
+++ b/www/assets/js/util.js
@@ -2269,8 +2269,8 @@ function execEmotes(msg) {
}
CHANNEL.emotes.forEach(function (e) {
- msg = msg.replace(e.regex, '');
+ msg = msg.replace(e.regex, '$1$2');
});
return msg;