mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-25 07:48:32 +00:00
Organz
(Organization)
This commit is contained in:
parent
fd9f7aafcf
commit
e483584eff
1 changed files with 18 additions and 14 deletions
|
@ -28,6 +28,21 @@ function icon(enabled?: boolean) {
|
||||||
</svg>;
|
</svg>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function processIds(value) {
|
||||||
|
return value.replace(/\s/g, "").split(",").filter(id => id.trim() !== "").join(", ");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function showNotification(message: Message, guildId?: string): Promise<void> {
|
||||||
|
await Notifications.showNotification({
|
||||||
|
title: `${message.author.globalName ?? message.author.username} ${guildId ? `sent a message in ${ChannelStore.getChannel(message.channel_id)?.name}` : "sent a message in a DM"}`,
|
||||||
|
body: message.content,
|
||||||
|
icon: UserStore.getUser(message.author.id).getAvatarURL(undefined, undefined, false),
|
||||||
|
onClick: function () {
|
||||||
|
NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${message.channel_id}/${message.id}`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function ContextCallback(name: "guild" | "user" | "channel"): NavContextMenuPatchCallback {
|
function ContextCallback(name: "guild" | "user" | "channel"): NavContextMenuPatchCallback {
|
||||||
return (children, props) => {
|
return (children, props) => {
|
||||||
const type = props[name];
|
const type = props[name];
|
||||||
|
@ -58,21 +73,21 @@ const settings = definePluginSettings({
|
||||||
description: "Guilds to let bypass (notified when pinged anywhere in guild)",
|
description: "Guilds to let bypass (notified when pinged anywhere in guild)",
|
||||||
default: "",
|
default: "",
|
||||||
placeholder: "Separate with commas",
|
placeholder: "Separate with commas",
|
||||||
onChange: value => settings.store.guilds = value.replace(/\s/g, "").split(",").filter(id => id.trim() !== "").join(", ")
|
onChange: value => settings.store.guilds = processIds(value)
|
||||||
},
|
},
|
||||||
channels: {
|
channels: {
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
description: "Channels to let bypass (notified when pinged in that channel)",
|
description: "Channels to let bypass (notified when pinged in that channel)",
|
||||||
default: "",
|
default: "",
|
||||||
placeholder: "Separate with commas",
|
placeholder: "Separate with commas",
|
||||||
onChange: value => settings.store.channels = value.replace(/\s/g, "").split(",").filter(id => id.trim() !== "").join(", ")
|
onChange: value => settings.store.channels = processIds(value)
|
||||||
},
|
},
|
||||||
users: {
|
users: {
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
description: "Users to let bypass (notified for all messages sent in DMs)",
|
description: "Users to let bypass (notified for all messages sent in DMs)",
|
||||||
default: "",
|
default: "",
|
||||||
placeholder: "Separate with commas",
|
placeholder: "Separate with commas",
|
||||||
onChange: value => settings.store.users = value.replace(/\s/g, "").split(",").filter(id => id.trim() !== "").join(", ")
|
onChange: value => settings.store.users = processIds(value)
|
||||||
},
|
},
|
||||||
allowOutsideOfDms: {
|
allowOutsideOfDms: {
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.BOOLEAN,
|
||||||
|
@ -80,17 +95,6 @@ const settings = definePluginSettings({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function showNotification(message: Message, guildId?: string): Promise<void> {
|
|
||||||
await Notifications.showNotification({
|
|
||||||
title: `${message.author.globalName ?? message.author.username} ${guildId ? `sent a message in ${ChannelStore.getChannel(message.channel_id)?.name}` : "sent a message in a DM"}`,
|
|
||||||
body: message.content,
|
|
||||||
icon: UserStore.getUser(message.author.id).getAvatarURL(undefined, undefined, false),
|
|
||||||
onClick: function () {
|
|
||||||
NavigationRouter.transitionTo(`/channels/${guildId ?? "@me"}/${message.channel_id}/${message.id}`);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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.",
|
||||||
|
|
Loading…
Add table
Reference in a new issue