mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Notify if no videos are found
This commit is contained in:
parent
ac9626efba
commit
cac26dae7e
3 changed files with 11 additions and 1 deletions
|
@ -93,7 +93,12 @@ class YtdlInfo:
|
|||
return []
|
||||
# If it is a playlist, create multiple videos!
|
||||
if "entries" in first_info:
|
||||
return [YtdlInfo(second_info) for second_info in first_info["entries"]]
|
||||
second_info_list = []
|
||||
for second_info in first_info["entries"]:
|
||||
if second_info is None:
|
||||
continue
|
||||
second_info_list.append(YtdlInfo(second_info))
|
||||
return second_info_list
|
||||
return [YtdlInfo(first_info)]
|
||||
|
||||
def to_discord_embed(self) -> discord.Embed:
|
||||
|
|
|
@ -99,6 +99,9 @@ class GenericBot:
|
|||
response: Response = await getattr(network_handler, self.interface_name)(self, request.data)
|
||||
return response.to_dict()
|
||||
except Exception:
|
||||
if __debug__:
|
||||
raise
|
||||
exit(1)
|
||||
_, exc, _ = sys.exc_info()
|
||||
log.debug(f"Exception {exc} in {network_handler}")
|
||||
return ResponseError("exception_in_handler",
|
||||
|
|
|
@ -67,6 +67,8 @@ class PlayCommand(Command):
|
|||
async def run(self, args: CommandArgs, data: CommandData) -> None:
|
||||
guild_name, url = args.match(r"(?:\[(.+)])?\s*<?(.+)>?")
|
||||
response = await self.interface.net_request(Request("music_play", {"url": url, "guild_name": guild_name}), "discord")
|
||||
if len(response["videos"]) == 0:
|
||||
await data.reply(f"⚠️ Nessun video trovato.")
|
||||
for video in response["videos"]:
|
||||
if self.interface.name == "discord":
|
||||
# This is one of the unsafest things ever
|
||||
|
|
Loading…
Reference in a new issue