MuteNewGuild -> NewGuildSettings; add 'show all channels' option (#2065)

Co-authored-by: MopigamesYT <mopigames@proton.me>
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
Margot 2024-02-18 17:42:26 +01:00 committed by GitHub
parent 7b96071643
commit c3030bbad0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 22 additions and 7 deletions

View file

@ -16,16 +16,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings,migratePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy } from "@webpack"; import { findByPropsLazy } from "@webpack";
const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings"); const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings");
const { toggleShowAllChannels } = findByPropsLazy("toggleShowAllChannels");
const { isOptInEnabledForGuild } = findByPropsLazy("isOptInEnabledForGuild");
const settings = definePluginSettings({ const settings = definePluginSettings({
guild: { guild: {
description: "Mute Guild", description: "Mute Guild automatically",
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
default: true default: true
}, },
@ -38,13 +40,20 @@ const settings = definePluginSettings({
description: "Suppress All Role @mentions", description: "Suppress All Role @mentions",
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
default: true default: true
},
showAllChannels: {
description: "Show all channels automatically",
type: OptionType.BOOLEAN,
default: true
} }
}); });
migratePluginSettings("NewGuildSettings", "MuteNewGuild");
export default definePlugin({ export default definePlugin({
name: "MuteNewGuild", name: "NewGuildSettings",
description: "Mutes newly joined guilds", description: "Automatically mute new servers and change various other settings upon joining",
authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince], tags: ["MuteNewGuild", "mute", "server"],
authors: [Devs.Glitch, Devs.Nuckyz, Devs.carince, Devs.Mopi],
patches: [ patches: [
{ {
find: ",acceptInvite(", find: ",acceptInvite(",
@ -70,7 +79,9 @@ export default definePlugin({
muted: settings.store.guild, muted: settings.store.guild,
suppress_everyone: settings.store.everyone, suppress_everyone: settings.store.everyone,
suppress_roles: settings.store.role suppress_roles: settings.store.role
});
if (settings.store.showAllChannels && isOptInEnabledForGuild(guildId)) {
toggleShowAllChannels(guildId);
} }
);
} }
}); });

View file

@ -399,6 +399,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "maisy", name: "maisy",
id: 257109471589957632n, id: 257109471589957632n,
}, },
Mopi: {
name: "Mopi",
id: 1022189106614243350n
},
Grzesiek11: { Grzesiek11: {
name: "Grzesiek11", name: "Grzesiek11",
id: 368475654662127616n, id: 368475654662127616n,