mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-23 11:13:51 -05:00
[Audio] Say no to busylooping :Awesome: (#3176)
* Say no to busylooping :Awesome: Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * chrore Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * black y u do dis 2 me Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com> * Return regardless if error is raised here
This commit is contained in:
@@ -39,7 +39,13 @@ from .apis import MusicCache, HAS_SQL, _ERROR
|
||||
from .checks import can_have_caching
|
||||
from .converters import ComplexScopeParser, ScopeParser, get_lazy_converter, get_playlist_converter
|
||||
from .equalizer import Equalizer
|
||||
from .errors import LavalinkDownloadFailed, MissingGuild, SpotifyFetchError, TooManyMatches
|
||||
from .errors import (
|
||||
DatabaseError,
|
||||
LavalinkDownloadFailed,
|
||||
MissingGuild,
|
||||
SpotifyFetchError,
|
||||
TooManyMatches,
|
||||
)
|
||||
from .manager import ServerManager
|
||||
from .playlists import (
|
||||
FakePlaylist,
|
||||
@@ -448,7 +454,16 @@ class Audio(commands.Cog):
|
||||
)
|
||||
if autoplay and not player.queue and player.fetch("playing_song") is not None:
|
||||
if self.owns_autoplay is None:
|
||||
await self.music_cache.autoplay(player)
|
||||
try:
|
||||
await self.music_cache.autoplay(player)
|
||||
except DatabaseError:
|
||||
notify_channel = player.fetch("channel")
|
||||
if notify_channel:
|
||||
notify_channel = self.bot.get_channel(notify_channel)
|
||||
await self._embed_msg(
|
||||
notify_channel, _("Autoplay: Couldn't get a valid track.")
|
||||
)
|
||||
return
|
||||
else:
|
||||
self.bot.dispatch(
|
||||
"red_audio_should_auto_play",
|
||||
@@ -2725,7 +2740,16 @@ class Audio(commands.Cog):
|
||||
if not await self._currency_check(ctx, guild_data["jukebox_price"]):
|
||||
return
|
||||
if self.owns_autoplay is None:
|
||||
await self.music_cache.autoplay(player)
|
||||
try:
|
||||
await self.music_cache.autoplay(player)
|
||||
except DatabaseError:
|
||||
notify_channel = player.fetch("channel")
|
||||
if notify_channel:
|
||||
notify_channel = self.bot.get_channel(notify_channel)
|
||||
await self._embed_msg(
|
||||
notify_channel, _("Autoplay: Couldn't get a valid track.")
|
||||
)
|
||||
return
|
||||
else:
|
||||
self.bot.dispatch(
|
||||
"red_audio_should_auto_play",
|
||||
|
||||
Reference in New Issue
Block a user