mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 07:48:32 +00:00
Let bypass users create notification outside of DM
This commit is contained in:
parent
58d64f7e77
commit
daee463e2a
1 changed files with 23 additions and 11 deletions
|
@ -115,6 +115,22 @@ const settings = definePluginSettings({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function showUserNotification(message: Message) {
|
||||||
|
await Notifications.showNotification({
|
||||||
|
title: `${message.author.globalName ?? message.author.username} sent a message in a DM`,
|
||||||
|
body: message.content,
|
||||||
|
icon: UserStore.getUser(message.author.id).getAvatarURL(undefined, undefined, false),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function showChannelNotification(message: Message) {
|
||||||
|
await Notifications.showNotification({
|
||||||
|
title: `${message.author.globalName ?? message.author.username} sent a message in ${ChannelStore.getChannel(message.channel_id).name}`,
|
||||||
|
body: message.content,
|
||||||
|
icon: UserStore.getUser(message.author.id).getAvatarURL(undefined, undefined, false),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "BypassDND",
|
name: "BypassDND",
|
||||||
description: "Still get notifications from specific sources when in do not disturb mode. Right-click on users/channels/guilds to set them to bypass do not disturb mode.",
|
description: "Still get notifications from specific sources when in do not disturb mode. Right-click on users/channels/guilds to set them to bypass do not disturb mode.",
|
||||||
|
@ -128,19 +144,15 @@ export default definePlugin({
|
||||||
if (message.author.id === currentUser.id) return;
|
if (message.author.id === currentUser.id) return;
|
||||||
if (await PresenceStore.getStatus(currentUser.id) != 'dnd') return;
|
if (await PresenceStore.getStatus(currentUser.id) != 'dnd') return;
|
||||||
if ((bypasses.guilds.includes(guildId) || bypasses.channels.includes(channelId)) && (message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id))) {
|
if ((bypasses.guilds.includes(guildId) || bypasses.channels.includes(channelId)) && (message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id))) {
|
||||||
await Notifications.showNotification({
|
await showChannelNotification(message);
|
||||||
title: `${message.author.globalName ?? message.author.username} sent a message in ${ChannelStore.getChannel(channelId).name}`,
|
|
||||||
body: message.content,
|
|
||||||
icon: UserStore.getUser(message.author.id).getAvatarURL(undefined, undefined, false),
|
|
||||||
});
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (bypasses.users.includes(message.author.id) && channelId === await PrivateChannelsStore.getOrEnsurePrivateChannel(message.author.id)) {
|
if (bypasses.users.includes(message.author.id)) {
|
||||||
await Notifications.showNotification({
|
if (channelId === await PrivateChannelsStore.getOrEnsurePrivateChannel(message.author.id)) {
|
||||||
title: `${message.author.globalName ?? message.author.username} sent a message in a DM`,
|
await showUserNotification(message);
|
||||||
body: message.content,
|
} else if (message.content.includes(`<@${currentUser.id}>`) || message.mentions.some(mention => mention.id === currentUser.id)) {
|
||||||
icon: UserStore.getUser(message.author.id).getAvatarURL(undefined, undefined, false),
|
await showChannelNotification(message);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue