Skip to content

Commit

Permalink
Default to YouTube streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
FeroxFoxxo committed Dec 11, 2023
1 parent d0f2a33 commit 1326b91
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion backend/Music/Commands/Play.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Discord.Interactions;
using Discord.WebSocket;
using Lavalink4NET.Players;
using Lavalink4NET.Rest.Entities.Tracks;
using Lavalink4NET.Tracks;
using Music.Abstractions;
using Music.Enums;
Expand Down Expand Up @@ -40,11 +41,14 @@ public async Task Play(
{
if (query != null)
{
if (source == MusicSource.Default)
searchMode = TrackSearchMode.YouTube;

var tracks = await Audio.Tracks.LoadTracksAsync(query, searchMode);

var lavalinkTracks = tracks.Tracks.ToList();

if (!lavalinkTracks.Any())
if (lavalinkTracks.Count == 0)
{
await RespondInteraction("Unable to get tracks. If this was a link to a stream or playlist, please use `/music play-stream` or `play-playlist`.");

Expand Down
2 changes: 1 addition & 1 deletion backend/Music/Commands/PlayStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public async Task PlayStream(
{
if (!Uri.IsWellFormedUriString(streamUrl, UriKind.Absolute))
{
await RespondInteraction("I need a valid stream URL to function");
await RespondInteraction("You need to provide a valid URL");
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task<IActionResult> CreateItem([FromRoute] ulong guildId, [FromRout

// Suspects can only comment if last comment was not by him.
if (!await identity.HasPermission(DiscordPermission.Moderator, guildId))
if (modCase.Comments.Any())
if (modCase.Comments.Count != 0)
if (modCase.Comments.Last().UserId == currentUser.Id)
throw new AlreadyCommentedException();

Expand Down

0 comments on commit 1326b91

Please sign in to comment.