This commit is contained in:
Mirco Wittrien 2021-04-13 16:30:51 +02:00
parent 59946d5ab2
commit ef5abb863a
2 changed files with 17 additions and 6 deletions

View File

@ -314,6 +314,7 @@
"Scrollers None": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerNone"}, "Scrollers None": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerNone"},
"Scrollers Thin": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerThin"}, "Scrollers Thin": {"props": ["AdvancedScrollerThin", "AdvancedScrollerAuto"], "value": "AdvancedScrollerThin"},
"Spinner": {"name": "Spinner"}, "Spinner": {"name": "Spinner"},
"Status": {"name": "Status"},
"StatusPickerPopout": {"strings": ["\"StatusPickerPopout\""], "value": "default"}, "StatusPickerPopout": {"strings": ["\"StatusPickerPopout\""], "value": "default"},
"TextElement": {"name": "Text"}, "TextElement": {"name": "Text"},
"UserPopout": {"name": "ConnectedUserPopout"}, "UserPopout": {"name": "ConnectedUserPopout"},
@ -767,7 +768,8 @@
"deleteIcon": "deleteIcon-22SgHa", "deleteIcon": "deleteIcon-22SgHa",
"dragPreview": "dragPreview-3F0ssT", "dragPreview": "dragPreview-3F0ssT",
"sortableCard": "sortableCard-oF6sTT", "sortableCard": "sortableCard-oF6sTT",
"sortDivider": "sortDivider-d8SzzU" "sortDivider": "sortDivider-d8SzzU",
"status": "status-0f5Sr2"
}, },
"DisplayServersAsChannels": { "DisplayServersAsChannels": {
"badge": "badge-fxFrUP", "badge": "badge-fxFrUP",
@ -1274,6 +1276,7 @@
"_customstatuspresetsdragpreview": ["CustomStatusPresets", "dragPreview"], "_customstatuspresetsdragpreview": ["CustomStatusPresets", "dragPreview"],
"_customstatuspresetssortablecard": ["CustomStatusPresets", "sortableCard"], "_customstatuspresetssortablecard": ["CustomStatusPresets", "sortableCard"],
"_customstatuspresetssortdivider": ["CustomStatusPresets", "sortDivider"], "_customstatuspresetssortdivider": ["CustomStatusPresets", "sortDivider"],
"_customstatuspresetsstatus": ["CustomStatusPresets", "status"],
"_displayserversaschannelsbadge": ["DisplayServersAsChannels", "badge"], "_displayserversaschannelsbadge": ["DisplayServersAsChannels", "badge"],
"_displayserversaschannelsname": ["DisplayServersAsChannels", "name"], "_displayserversaschannelsname": ["DisplayServersAsChannels", "name"],
"_displayserversaschannelsstyled": ["DisplayServersAsChannels", "styled"], "_displayserversaschannelsstyled": ["DisplayServersAsChannels", "styled"],

View File

@ -2,7 +2,7 @@
* @name CustomStatusPresets * @name CustomStatusPresets
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.0.5 * @version 1.0.6
* @description Allows you to save Custom Statuses as Quick Select * @description Allows you to save Custom Statuses as Quick Select
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "CustomStatusPresets", "name": "CustomStatusPresets",
"author": "DevilBro", "author": "DevilBro",
"version": "1.0.5", "version": "1.0.6",
"description": "Allows you to save Custom Statuses as Quick Select" "description": "Allows you to save Custom Statuses as Quick Select"
}, },
"changeLog": { "changeLog": {
"improved": { "added": {
"Settings": "You can now reorder the presets in the plugin settings and 'disable' them which stops them from showing in the quick menu" "Online Status": "The online status now also gets saved in the preset"
} }
} }
}; };
@ -282,6 +282,9 @@ module.exports = (_ => {
display: flex; display: flex;
margin-right: 6px; margin-right: 6px;
} }
${BDFDB.dotCN._customstatuspresetsstatus} {
margin-right: 6px;
}
${BDFDB.dotCN._customstatuspresetssortdivider} { ${BDFDB.dotCN._customstatuspresetssortdivider} {
background: ${BDFDB.DiscordConstants.Colors.STATUS_GREEN}; background: ${BDFDB.DiscordConstants.Colors.STATUS_GREEN};
height: 2px; height: 2px;
@ -360,6 +363,10 @@ module.exports = (_ => {
}) })
}) })
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Status, {
className: BDFDB.disCN._customstatuspresetsstatus,
status: presets[id].status || BDFDB.DiscordConstants.StatusTypes.ONLINE
}),
presets[id].text presets[id].text
] ]
}), }),
@ -373,6 +380,7 @@ module.exports = (_ => {
expiresAt = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1).getTime() - date.getTime(); expiresAt = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1).getTime() - date.getTime();
} }
BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({ BDFDB.LibraryModules.SettingsUtils.updateRemoteSettings({
status: presets[id].status,
customStatus: { customStatus: {
text: presets[id].text && presets[id].text.length > 0 ? presets[id].text : null, text: presets[id].text && presets[id].text.length > 0 ? presets[id].text : null,
expiresAt: expiresAt ? BDFDB.DiscordObjects.Timestamp().add(expiresAt, "ms").toISOString() : null, expiresAt: expiresAt ? BDFDB.DiscordObjects.Timestamp().add(expiresAt, "ms").toISOString() : null,
@ -394,7 +402,7 @@ module.exports = (_ => {
color: BDFDB.disCN.modalcancelbutton, color: BDFDB.disCN.modalcancelbutton,
look: BDFDB.LibraryComponents.Button.Looks.LINK, look: BDFDB.LibraryComponents.Button.Looks.LINK,
onClick: event => { onClick: event => {
presets[id] = Object.assign({pos: Object.keys(presets).length}, BDFDB.ObjectUtils.extract(e.instance.state, "clearAfter", "emojiInfo", "text")); presets[id] = Object.assign({pos: Object.keys(presets).length}, BDFDB.ObjectUtils.extract(e.instance.state, "clearAfter", "emojiInfo", "status", "text"));
BDFDB.DataUtils.save(presets, this, "presets"); BDFDB.DataUtils.save(presets, this, "presets");
if (!event.shiftKey) e.instance.props.onClose(); if (!event.shiftKey) e.instance.props.onClose();
else id = BDFDB.NumberUtils.generateId(Object.keys(presets)); else id = BDFDB.NumberUtils.generateId(Object.keys(presets));