SecretRingToneEnabler: Option to always play Snow Halation Theme (#2831)

This commit is contained in:
Ramzi Al Haddad 2024-09-03 05:50:25 -05:00 committed by GitHub
parent 30e4e83158
commit 7f784befc2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 9 deletions

View file

@ -4,21 +4,38 @@
* SPDX-License-Identifier: GPL-3.0-or-later * SPDX-License-Identifier: GPL-3.0-or-later
*/ */
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
const settings = definePluginSettings({
onlySnow: {
type: OptionType.BOOLEAN,
description: "Only play the Snow Halation Theme",
default: false,
restartNeeded: true
}
});
// NOTE - Ultimately should probably be turned into a ringtone picker plugin
export default definePlugin({ export default definePlugin({
name: "SecretRingToneEnabler", name: "SecretRingToneEnabler",
description: "Always play the secret version of the discord ringtone (except during special ringtone events)", description: "Always play the secret version of the discord ringtone (except during special ringtone events)",
authors: [Devs.AndrewDLO, Devs.FieryFlames], authors: [Devs.AndrewDLO, Devs.FieryFlames, Devs.RamziAH],
settings,
patches: [ patches: [
{ {
find: '"call_ringing_beat"', find: '"call_ringing_beat"',
replacement: { replacement: [
{
match: /500!==\i\(\)\.random\(1,1e3\)/, match: /500!==\i\(\)\.random\(1,1e3\)/,
replace: "false", replace: "false"
}
}, },
], {
predicate: () => settings.store.onlySnow,
match: /"call_ringing_beat",/,
replace: ""
}
]
}
]
}); });

View file

@ -566,6 +566,10 @@ export const Devs = /* #__PURE__*/ Object.freeze({
name: "niko", name: "niko",
id: 341377368075796483n, id: 341377368075796483n,
}, },
RamziAH: {
name: "RamziAH",
id: 1279957227612147747n,
},
} satisfies Record<string, Dev>); } satisfies Record<string, Dev>);
// iife so #__PURE__ works correctly // iife so #__PURE__ works correctly