diff options
author | V <vendicated@riseup.net> | 2023-06-23 18:09:43 +0200 |
---|---|---|
committer | V <vendicated@riseup.net> | 2023-06-23 18:09:43 +0200 |
commit | d7ac418e05f43255c42ea115c9c352cf214753d5 (patch) | |
tree | cd4c148023aab0aa3ffdd6785e7d22d6ab834613 /src/plugins/relationshipNotifier | |
parent | 214c101740622a8cc1c9cfbce8d51946564441da (diff) | |
download | Vencord-d7ac418e05f43255c42ea115c9c352cf214753d5.tar.gz Vencord-d7ac418e05f43255c42ea115c9c352cf214753d5.tar.bz2 Vencord-d7ac418e05f43255c42ea115c9c352cf214753d5.zip |
Fix some plugins displaying legacy discriminators (username#0000)
Diffstat (limited to 'src/plugins/relationshipNotifier')
-rw-r--r-- | src/plugins/relationshipNotifier/functions.ts | 13 | ||||
-rw-r--r-- | src/plugins/relationshipNotifier/utils.ts | 18 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/plugins/relationshipNotifier/functions.ts b/src/plugins/relationshipNotifier/functions.ts index c9ec6e3..104436a 100644 --- a/src/plugins/relationshipNotifier/functions.ts +++ b/src/plugins/relationshipNotifier/functions.ts @@ -16,6 +16,7 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +import { getUniqueUsername, openUserProfile } from "@utils/discord"; import { UserUtils } from "@webpack/common"; import settings from "./settings"; @@ -43,11 +44,19 @@ export async function onRelationshipRemove({ relationship: { type, id } }: Relat switch (type) { case RelationshipType.FRIEND: if (settings.store.friends) - notify(`${user.tag} removed you as a friend.`, user.getAvatarURL(undefined, undefined, false)); + notify( + `${getUniqueUsername(user)} removed you as a friend.`, + user.getAvatarURL(undefined, undefined, false), + () => openUserProfile(user.id) + ); break; case RelationshipType.FRIEND_REQUEST: if (settings.store.friendRequestCancels) - notify(`A friend request from ${user.tag} has been removed.`, user.getAvatarURL(undefined, undefined, false)); + notify( + `A friend request from ${getUniqueUsername(user)} has been removed.`, + user.getAvatarURL(undefined, undefined, false), + () => openUserProfile(user.id) + ); break; } } 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 }); } |