aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/relationshipNotifier/utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/relationshipNotifier/utils.ts')
-rw-r--r--src/plugins/relationshipNotifier/utils.ts18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/plugins/relationshipNotifier/utils.ts b/src/plugins/relationshipNotifier/utils.ts
index 60fb0c6..d5fd1da 100644
--- a/src/plugins/relationshipNotifier/utils.ts
+++ b/src/plugins/relationshipNotifier/utils.ts
@@ -18,6 +18,7 @@
import { DataStore, Notices } from "@api/index";
import { showNotification } from "@api/Notifications";
+import { getUniqueUsername, openUserProfile } from "@utils/discord";
import { ChannelStore, GuildMemberStore, GuildStore, RelationshipStore, UserStore, UserUtils } from "@webpack/common";
import settings from "./settings";
@@ -69,7 +70,11 @@ export async function syncAndRunChecks() {
const user = await UserUtils.fetchUser(id).catch(() => void 0);
if (user)
- notify(`You are no longer friends with ${user.tag}.`, user.getAvatarURL(undefined, undefined, false));
+ notify(
+ `You are no longer friends with ${getUniqueUsername(user)}.`,
+ user.getAvatarURL(undefined, undefined, false),
+ () => openUserProfile(user.id)
+ );
}
}
@@ -79,20 +84,25 @@ export async function syncAndRunChecks() {
const user = await UserUtils.fetchUser(id).catch(() => void 0);
if (user)
- notify(`Friend request from ${user.tag} has been revoked.`, user.getAvatarURL(undefined, undefined, false));
+ notify(
+ `Friend request from ${getUniqueUsername(user)} has been revoked.`,
+ user.getAvatarURL(undefined, undefined, false),
+ () => openUserProfile(user.id)
+ );
}
}
}
}
-export function notify(text: string, icon?: string) {
+export function notify(text: string, icon?: string, onClick?: () => void) {
if (settings.store.notices)
Notices.showNotice(text, "OK", () => Notices.popNotice());
showNotification({
title: "Relationship Notifier",
body: text,
- icon
+ icon,
+ onClick
});
}