NewGuildSettings: add push notifs, highlights & events (#2413)

Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Gabriel Ruiz Pérez 2024-05-04 01:15:18 +02:00 committed by GitHub
parent a6c09bc909
commit 04d7cb8797
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 35 additions and 3 deletions

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings,migratePluginSettings } from "@api/Settings";
import { definePluginSettings, migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack";
@ -31,6 +31,16 @@ const settings = definePluginSettings({
type: OptionType.BOOLEAN,
default: true
},
messages: {
description: "Server Notification Settings",
type: OptionType.SELECT,
options: [
{ label: "All messages", value: 0 },
{ label: "Only @mentions", value: 1 },
{ label: "Nothing", value: 2 },
{ label: "Server default", value: 3, default: true }
],
},
everyone: {
description: "Suppress @everyone and @here",
type: OptionType.BOOLEAN,
@ -41,6 +51,16 @@ const settings = definePluginSettings({
type: OptionType.BOOLEAN,
default: true
},
highlights: {
description: "Suppress Highlights automatically",
type: OptionType.BOOLEAN,
default: true
},
events: {
description: "Mute New Events automatically",
type: OptionType.BOOLEAN,
default: true
},
showAllChannels: {
description: "Show all channels automatically",
type: OptionType.BOOLEAN,
@ -53,7 +73,7 @@ export default definePlugin({
name: "NewGuildSettings",
description: "Automatically mute new servers and change various other settings upon joining",
tags: ["MuteNewGuild", "mute", "server"],
authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi],
authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi, Devs.GabiRP],
patches: [
{
find: ",acceptInvite(",
@ -78,8 +98,16 @@ export default definePlugin({
{
muted: settings.store.guild,
suppress_everyone: settings.store.everyone,
suppress_roles: settings.store.role
suppress_roles: settings.store.role,
mute_scheduled_events: settings.store.events,
notify_highlights: settings.store.highlights ? 1 : 0
});
if (settings.store.messages !== 3) {
updateGuildNotificationSettings(guildId,
{
message_notifications: settings.store.messages,
});
}
if (settings.store.showAllChannels && isOptInEnabledForGuild(guildId)) {
toggleShowAllChannels(guildId);
}

View file

@ -449,6 +449,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
PolisanTheEasyNick: {
name: "Oleh Polisan",
id: 242305263313485825n
},
GabiRP: {
name: "GabiRP",
id: 507955112027750401n
}
} satisfies Record<string, Dev>);