StatusWhilePlaying: Logic Updates

This commit is contained in:
thororen1234 2025-09-25 11:20:50 -04:00
parent 20b7e0a5fc
commit db4c865eee
No known key found for this signature in database

View file

@ -11,7 +11,7 @@ import definePlugin, { OptionType } from "@utils/types";
import { PresenceStore, UserStore } from "@webpack/common";
let savedStatus = "";
const statusSettings = getUserSettingLazy("status", "status");
const StatusSettings = getUserSettingLazy("status", "status");
const settings = definePluginSettings({
statusToSet: {
type: OptionType.SELECT,
@ -44,17 +44,18 @@ export default definePlugin({
authors: [Devs.thororen],
settings,
flux: {
RUNNING_GAMES_CHANGE(event) {
const status = PresenceStore.getStatus(UserStore.getCurrentUser().id);
if (event.games.length > 0) {
RUNNING_GAMES_CHANGE({ games }) {
const userId = UserStore.getCurrentUser().id;
const status = PresenceStore.getStatus(userId);
if (games.length > 0) {
if (status !== settings.store.statusToSet) {
savedStatus = status;
statusSettings?.updateSetting(settings.store.statusToSet);
StatusSettings?.updateSetting(settings.store.statusToSet);
}
} else {
if (savedStatus !== "" && savedStatus !== settings.store.statusToSet)
statusSettings?.updateSetting(savedStatus);
} else if (savedStatus && savedStatus !== settings.store.statusToSet) {
StatusSettings?.updateSetting(savedStatus);
}
},
}
}
});