mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
feat(autopause): autoPauseOnEmpty toggle in Settings
This commit is contained in:
1 parent
491bc53dec
commit
34655e5f50
1 file changed
+24
-1
@@ -433,6 +433,18 @@
|
|||||||
<button class="btn-primary" @click="saveIdleTimeout">保存</button>
|
<button class="btn-primary" @click="saveIdleTimeout">保存</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<label class="profile-toggle behavior-toggle">
|
||||||
|
<div class="profile-toggle-text">
|
||||||
|
<div class="profile-toggle-label">频道无人时自动暂停播放</div>
|
||||||
|
<div class="profile-toggle-hint">机器人所在频道没有其他人时自动暂停,有人加入后可继续播放</div>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
v-model="autoPauseOnEmpty"
|
||||||
|
type="checkbox"
|
||||||
|
class="profile-toggle-switch"
|
||||||
|
@change="saveIdleTimeout"
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Bot Profile (TeamSpeak Behavior) -->
|
<!-- Bot Profile (TeamSpeak Behavior) -->
|
||||||
@@ -885,17 +897,22 @@ async function savePrefix() {
|
|||||||
|
|
||||||
// Idle timeout
|
// Idle timeout
|
||||||
const idleTimeout = ref(0);
|
const idleTimeout = ref(0);
|
||||||
|
const autoPauseOnEmpty = ref(true);
|
||||||
|
|
||||||
async function loadIdleTimeout() {
|
async function loadIdleTimeout() {
|
||||||
try {
|
try {
|
||||||
const res = await axios.get('/api/bot/settings');
|
const res = await axios.get('/api/bot/settings');
|
||||||
idleTimeout.value = res.data.idleTimeoutMinutes ?? 0;
|
idleTimeout.value = res.data.idleTimeoutMinutes ?? 0;
|
||||||
|
autoPauseOnEmpty.value = res.data.autoPauseOnEmpty ?? true;
|
||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveIdleTimeout() {
|
async function saveIdleTimeout() {
|
||||||
try {
|
try {
|
||||||
await axios.post('/api/bot/settings', { idleTimeoutMinutes: idleTimeout.value });
|
await axios.post('/api/bot/settings', {
|
||||||
|
idleTimeoutMinutes: idleTimeout.value,
|
||||||
|
autoPauseOnEmpty: autoPauseOnEmpty.value,
|
||||||
|
});
|
||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1794,6 +1811,12 @@ onUnmounted(() => {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Standalone toggle inside 行为设置 (not part of a bordered list)
|
||||||
|
.behavior-toggle {
|
||||||
|
border-bottom: none;
|
||||||
|
padding-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.profile-bot-header {
|
.profile-bot-header {
|
||||||
padding: 14px 12px;
|
padding: 14px 12px;
|
||||||
|
|||||||
Reference in new issue
Block a user