Merge pull request #123 from Chili-Bebber/patch-1
Fix repeat command crashing when queue is empty
This commit is contained in:
commit
e1c5fc32e9
17
command.py
17
command.py
@ -828,14 +828,17 @@ def cmd_repeat(bot, user, text, command, parameter):
|
|||||||
repeat = int(parameter)
|
repeat = int(parameter)
|
||||||
|
|
||||||
music = var.playlist.current_item()
|
music = var.playlist.current_item()
|
||||||
for _ in range(repeat):
|
if music:
|
||||||
var.playlist.insert(
|
for _ in range(repeat):
|
||||||
var.playlist.current_index + 1,
|
var.playlist.insert(
|
||||||
music
|
var.playlist.current_index + 1,
|
||||||
)
|
music
|
||||||
log.info("bot: add to playlist: " + music.format_debug_string())
|
)
|
||||||
|
log.info("bot: add to playlist: " + music.format_debug_string())
|
||||||
|
|
||||||
bot.send_channel_msg(constants.strings("repeat", song=music.format_song_string(), n=str(repeat)))
|
bot.send_channel_msg(constants.strings("repeat", song=music.format_song_string(), n=str(repeat)))
|
||||||
|
else:
|
||||||
|
bot.send_channel_msg(constants.strings("queue_empty"))
|
||||||
|
|
||||||
|
|
||||||
def cmd_mode(bot, user, text, command, parameter):
|
def cmd_mode(bot, user, text, command, parameter):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user