feat: add 'clear_when_stop_in_oneshot' option in config for azlux
This commit is contained in:
parent
4e287d6b1b
commit
1d1ff50a59
@ -565,7 +565,11 @@ def cmd_help(bot, user, text, command, parameter):
|
||||
def cmd_stop(bot, user, text, command, parameter):
|
||||
global log
|
||||
|
||||
bot.stop()
|
||||
if var.config.getboolean("bot", "clear_when_stop_in_oneshot", fallback=False) \
|
||||
and var.playlist.mode == 'one-shot':
|
||||
cmd_clear(bot, user, text, command, parameter)
|
||||
else:
|
||||
bot.stop()
|
||||
bot.send_msg(constants.strings('stopped'), text)
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ volume = 0.1
|
||||
# playback mode should be one of "one-shot", "loop", "random", "autoplay"
|
||||
playback_mode = one-shot
|
||||
autoplay_length = 5
|
||||
clear_when_stop_in_oneshot = False
|
||||
|
||||
# target version, stable or testing (testing need to bot installed with git)
|
||||
target_version = stable
|
||||
|
@ -33,8 +33,10 @@ port = 64738
|
||||
# or "random" (randomize the playlist), "autoplay" (randomly grab something from the music library).
|
||||
# This option will be overridden by value in the database.
|
||||
# 'autoplay_length': how many songs the autoplay mode fills the playlist
|
||||
# 'clear_when_stop_in_oneshot': clear the playlist when stop the bot in one-shot mode.
|
||||
#playback_mode = one-shot
|
||||
#autoplay_length = 5
|
||||
#clear_when_stop_in_oneshot = False
|
||||
|
||||
# target version, stable or testing (testing need to bot installed with git)
|
||||
# stable will use simple bash with curl command to get releases, testing will follow github master branch with git commands
|
||||
|
@ -334,7 +334,11 @@ def post():
|
||||
var.cache.build_dir_cache(var.bot)
|
||||
log.info("web: Local file cache refreshed.")
|
||||
elif action == "stop":
|
||||
var.bot.stop()
|
||||
if var.config.getboolean("bot", "clear_when_stop_in_oneshot", fallback=False) \
|
||||
and var.playlist.mode == 'one-shot':
|
||||
var.bot.clear()
|
||||
else:
|
||||
var.bot.stop()
|
||||
elif action == "pause":
|
||||
var.bot.pause()
|
||||
elif action == "resume":
|
||||
|
Loading…
x
Reference in New Issue
Block a user