diff --git a/Plugins/FriendNotifications/FriendNotifications.plugin.js b/Plugins/FriendNotifications/FriendNotifications.plugin.js
index 5bc57d95df..ceee3c02b3 100644
--- a/Plugins/FriendNotifications/FriendNotifications.plugin.js
+++ b/Plugins/FriendNotifications/FriendNotifications.plugin.js
@@ -2,7 +2,7 @@
* @name FriendNotifications
* @author DevilBro
* @authorId 278543574059057154
- * @version 1.8.7
+ * @version 1.8.8
* @description Shows a Notification when a Friend or a User, you choose to observe, changes their Status
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@@ -14,7 +14,9 @@
module.exports = (_ => {
const changeLog = {
-
+ "added": {
+ "$nick": "New placeholder for friend nicknames"
+ }
};
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@@ -604,6 +606,7 @@ module.exports = (_ => {
"Allows you to configure your own Message Strings for the different Statuses.",
[
["$user", " is the Placeholder for the Username"],
+ ["$nick", " for the Friend Nickname (fallback to $user if unused)"],
["$status", " for the Status Name"],
["$statusOld", " for the previous Status Name"],
["$custom", " for the Custom Status"],
@@ -827,6 +830,7 @@ module.exports = (_ => {
))) {
let EUdata = BDFDB.BDUtils.isPluginEnabled("EditUsers") && BDFDB.DataUtils.load("EditUsers", "users", user.id) || {};
let name = EUdata.name || user.username;
+ let nickname = EUdata.name || BDFDB.LibraryStores.RelationshipStore.getNickname(user.id);
let avatar = EUdata.removeIcon ? "" : (EUdata.url || BDFDB.UserUtils.getAvatar(user.id));
let timestamp = new Date().getTime();
@@ -834,8 +838,17 @@ module.exports = (_ => {
let oldStatusName = this.getStatusName(id, userStatusStore[id]);
let string = this.settings.notificationStrings[screensharingNotice ? "screensharing" : customChanged ? "custom" : loginNotice ? "login" : status.name] || "'$user' changed status to '$status'";
- let toastString = BDFDB.StringUtils.htmlEscape(string).replace(/'{0,1}\$user'{0,1}/g, `${BDFDB.StringUtils.htmlEscape(name)}${this.settings.general.showDiscriminator ? ("#" + user.discriminator) : ""}`).replace(/'{0,1}\$statusOld'{0,1}/g, `${oldStatusName}`).replace(/'{0,1}\$status'{0,1}/g, `${statusName}`);
- if (status.activity) toastString = toastString.replace(/'{0,1}\$song'{0,1}|'{0,1}\$game'{0,1}/g, `${status.activity.name || status.activity.details || ""}`).replace(/'{0,1}\$artist'{0,1}|'{0,1}\$custom'{0,1}/g, `${[status.activity.emoji && status.activity.emoji.name, status.activity.state].filter(n => n).join(" ") || ""}`);
+ let hasUserPlaceholder = string.indexOf("$user") > -1;
+ let toastString = BDFDB.StringUtils.htmlEscape(string)
+ .replace(/'{0,1}\$user'{0,1}/g, `${BDFDB.StringUtils.htmlEscape(name)}${this.settings.general.showDiscriminator ? ("#" + user.discriminator) : ""}`)
+ .replace(/'{0,1}\$nick'{0,1}/g, nickname ? `${BDFDB.StringUtils.htmlEscape(nickname)}${!hasUserPlaceholder && this.settings.general.showDiscriminator ? ("#" + user.discriminator) : ""}` : !hasUserPlaceholder ? `${BDFDB.StringUtils.htmlEscape(name)}${this.settings.general.showDiscriminator ? ("#" + user.discriminator) : ""}` : "")
+ .replace(/'{0,1}\$statusOld'{0,1}/g, `${oldStatusName}`)
+ .replace(/'{0,1}\$status'{0,1}/g, `${statusName}`);
+ if (status.activity) {
+ toastString = toastString
+ .replace(/'{0,1}\$song'{0,1}|'{0,1}\$game'{0,1}/g, `${status.activity.name || status.activity.details || ""}`)
+ .replace(/'{0,1}\$artist'{0,1}|'{0,1}\$custom'{0,1}/g, `${[status.activity.emoji && status.activity.emoji.name, status.activity.state].filter(n => n).join(" ") || ""}`);
+ }
let statusType = BDFDB.UserUtils.getStatus(user.id);
if (observedUsers[id].timelog == undefined || observedUsers[id].timelog) timeLog.unshift({