feat: settings sliders (#120)

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
megumin 2022-10-19 20:57:27 +01:00 committed by GitHub
parent efab399309
commit 1f50f78912
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 123 additions and 40 deletions

View file

@ -1,8 +1,11 @@
import definePlugin from "../utils/types";
import { Devs } from "../utils/constants";
import { Message, ReactionEmoji } from "discord-types/general";
import { FluxDispatcher, SelectedChannelStore } from "../webpack/common";
import { makeRange } from "../components/PluginSettings/components/SettingSliderComponent";
import { Devs } from "../utils/constants";
import { sleep } from "../utils/misc";
import definePlugin, { OptionType } from "../utils/types";
import { Settings } from "../Vencord";
import { FluxDispatcher, SelectedChannelStore } from "../webpack/common";
interface IMessageCreate {
type: "MESSAGE_CREATE";
@ -67,6 +70,16 @@ export default definePlugin({
FluxDispatcher.unsubscribe("MESSAGE_CREATE", this.onMessage);
FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD", this.onReaction);
},
options: {
volume: {
description: "Volume of the 🗿🗿🗿",
type: OptionType.SLIDER,
markers: makeRange(0, 1, 0.1),
default: 0.5,
stickToMarkers: false,
}
}
});
function countOccurrences(sourceString: string, subString: string) {
@ -101,5 +114,6 @@ function getMoyaiCount(message: string) {
function boom() {
const audioElement = document.createElement("audio");
audioElement.src = MOYAI_URL;
audioElement.volume = Settings.plugins.Moyai.volume;
audioElement.play();
}