StatusWhilePlaying: Logic Updates
This commit is contained in:
parent
20b7e0a5fc
commit
db4c865eee
1 changed files with 10 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue