Code Monkey home page Code Monkey logo

victoria's Introduction


victoria's People

Contributors

alexandrebazeaud avatar magicaljellyfish avatar maniacalsheep avatar yucked avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

victoria's Issues

[ BUG ] "Connected and new voice channel ids are the same"


Version: 5.1.2

Describe the bug/issue.

So this issue occurs pretty much randomly when the bot looses connection and seems like it's not really reproducable for me.

This is the main code I use when playing music to check if the player exist, if not the bot should join the channel:
var player = _lavaNode.HasPlayer(Context.Guild) ? _lavaNode.GetPlayer(Context.Guild) : await _lavaNode.JoinAsync((Context.User as IGuildUser).VoiceChannel, Context.Channel as ITextChannel);

Seems like the issue is caused in the JoinAsync in which the old player voicechannel is the same as the new one. Just to confirm again the bot is not connected to any voice channel when this happens. It was connected to this voicechannel before though before it "randomly" lost connection.

Stacktrace / Screenshots

Connected and new voice channel ids are the same.

Authorization failed for 127.0.0.1 on GET /loadtracks

I get this error when trying to use different passwords other then the default "youshallnotpass"

Authorization failed for 127.0.0.1 on GET /loadtracks
#application.yml
lavalink:
  server:
    password: "newPassword"
// MusicService.cs
await _lavaSocketClient.StartAsync(_client, new Configuration
{
    Host = "127.0.0.1",
    Password = "newPassword"
});

[ BUG ] SetVolumeAsync after SkipAsync (can) throw(s) InvalidOperationException


Describe the bug/issue.

If you try to set the volume with LavaPlayer.SetVolumeAsync after skipping the current track with SkipAsync, you can get an exception:

This operation is invalid since player isn't actually playing anything.

I get this problem in Discord.Net commands using your Prototype bot.
Only added a SetVolume command and it normally works fine, but after using the skip command it can't use SetVolumeAsync anymore.
Tried to use SetVolumeAsync right after skipping the track and it worked. Also tried to use LavaSocketClient.GetPlayer and SetVolumeAsync with the returned player right after skipping the track, it worked again.
It's only not working in another command.

player.CurrentTrack isn't empty, the "NowPlaying" command works perfectly.

Stacktrace / Screenshots

at Victoria.LavaPlayer.SetVolumeAsync(Int32 volume)
at BonusBot.AudioModule.SetVolume(Int32 volume) in [MyPath]
at Discord.Commands.ModuleClassBuilder.<>c__DisplayClass6_0.<g__ExecuteCallback|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Discord.Commands.CommandInfo.ExecuteInternalAsync(ICommandContext context, Object[] args, IServiceProvider services)

How to run LavaLink in the cloud?

I have LavaLink running on a Linux instance using aws and I have port 2333 allowed though its firewall but I cant seem to connect to it

await _lavaSocketClient.StartAsync(_client, new Configuration
    {
        Password = "password",
        Host = "public ip_v4", /*not gonna show the real host ip*/
        Port = 2333
});

Editing Victoria...

Are we allowed to download, edit & recompile Victoria??
I would like to edit a few things on this but only if allowed.

Thanks in advance

Change LavaNode.UpdateTextChannel parameters

May I ask why you made the decision to have both the IGuild and ITextChannel as parameters for the method UpdateTextChannel in LavaNode?
As ITextChannel already has IGuild as a property, I fail to see why you would also want IGuild as a parameter for the method.

[ BUG ] No connection could be made because the target machine actively refused it


Describe the bug/issue.

Hello.

I got an issue with my Discord bot. When I try to use the SearchAsync () or SearchYouTubeAsync () method, I get this error message. I disabled the firewall but it didn't work like the other solutions I've used.

I will be very grateful for your help in solving this problem.

Stacktrace / Screenshots

image

[ BUG ] No payloads from LL after a while

After a while, apparently mostly after using SoundCloud tracks, Victoria does not receive anymore payloads from Lavalink. I tried using LogSeverity.Debug which bypasses the Players.TryGetValue check, and nothing gets logged so the problem comes from something else than a threading issue. It could be the SocketHelper class or Lavalink itself, although the later seems unlikely considering I've found no similar issue among other wrappers.

This is on the V4 version of Victoria.

[ BUG ] Search Request Actively Refused


Describe the bug/issue.

Hey,
so i was trying to implement a music bot with .net core 3.0 and this guy:
image

caused an major issue:
image

I downloaded your given Example "Party-Bot" and the same error occured.

After some research i found this article: https://support.discordapp.com/hc/de/articles/360035010351--Known-Issue-Music-Bots-Not-Playing-Music-From-Certain-Sources

Is it possible that SearchRequest cannot be executed with the current Version of Victoria/LavaLink?

Thanks for your responses!

Stacktrace / Screenshots

image

[ BUG ] SearchAsync always returning NoMatches


Describe the bug/issue.

This could be related to my lavalink possibly but for some reason when using SearchAsync(someQuery); its loadstatus is always NoMatches. When using SearchYouTubeAsync(someQuery); this seems to not occur.

In other relations it seems like I am doing something wrong when trying to load a playlist too from youtube. Always get the Could not find tracks from mix. or Something went wrong when looking up the track exception when using SearchYoutubeAsync and a query which consists of a link to a playlist. This could also relate to LavaLink though...

[ BUG ] Playing music via YouTube url's stopped working since this morning


Describe the bug/issue.

Everything was working fine up until this morning where a user in my discord reported the bot been broken when looking up youtube urls...
Everything still works for other services such as for example: soundcloud

I tried many different things to come to the point where I believe this problem cannot be fixed on my side but has something to do with Victoria trying to load in youtube information and failing to do so. (thats just a guess at this moment, not pointing fingers)

Can you please look into this, I also uploaded my log file with the latest log when I tested it myself.
Thanks in advance

Stacktrace / Screenshots

log.txt

LavaNode.TrackUpdate nullifies track during TrackReason.Replaced

At the moment it's imposible to skip a song correctly because when a song is skipped, the TrackReason.Replaced Finished event is triggered and LavaNode.TrackUpdate nullifies the new track you assigned. Internally the playback works. But anything that relies on LavaPlayer.CurrentTrack is now broken.

I suggest the following change:

private void TrackUpdate(TrackFinishData data)
{
    if (data.Reason != TrackReason.Replaced)
        data.LavaPlayer.CurrentTrack = null;
    Finished?.Invoke(data.LavaPlayer, data.Track, data.Reason);
}

Suggestion: Make all folders not be a namespace provider

So I love namespaces, and you've arranged the folder structure perfectly in your library, but I think that when designing a library, you should keep in mind that the user prefers not to import many different namespaces.
And since you have about 2 folders deep (ex: Victoria.Entities.Enums) I think disabling namespace provider on each folder- aka putting all classes at the Victoria root namespace without changing the folder scheme would be great.

Skip function

public void Skip()
    {
      if (!this.IsConnected)
        throw new InvalidOperationException("Either this player isn't connected or connection isn't valid.");
      this.Dequeue(this.CurrentTrack);
      this._lavaSocket.SendPayload((LavaPayload) new StopPayload(this.Guild.Id));
      LavaTrack track = this.Queue.First?.Value;
      if (this.Queue.Count < 1 || track == null)
      {
        Volatile.Write(ref this.IsDisposed, true);
        throw new InvalidOperationException("Queue is empty. No more songs to play.");
      }
      this.CurrentTrack = track;
      Volatile.Write(ref this.IsDisposed, false);
      this._lavaSocket.SendPayload((LavaPayload) new PlayPayload(this.Guild.Id, track));
    }

I see some problems with this code. As far as i understand how the wrapper is constructed the first dequeue doesnt do anything. Since the current track isnt part of the queue. also if the queue is empty it will set this disposed variable again which bricks the leave. So it doesnt leave but brick the leave function.
also the track that is used for the next track isnt dequeued.

[ BUG ] V5 has a dependency on Socks v1.4.1 but it's not available on Nuget


Describe the bug/issue.

As the title says, the latest version of Victoria requires Socks v1.4.1. However it's not currently available. As such we are unable to update to the latest version via Nuget.

โ„น๏ธ (Not an issue if we simply add the source ourselves, however I doubt everyone will do that, or even want to do that)

Stacktrace / Screenshots

SS

More optimized shuffle implementation

public void Shuffle()

The current implementation used is slow and not very efficient. The following is better:

public static void Shuffle<T>(this LinkedList<T> list)
    {
        if (list.Count < 2)
        {
            return;
        }
        var result = new T[list.Count];
        int i = 0;
        for (var node = list.First; node != null; node = node.Next)
        {
            int j = Random.Next(i + 1); // Whatever System.Random implementation is used.
            if (i != j)
            {
                result[i] = result[j];
            }
            result[j] = node.Value;
            i++;
        }
        list.Clear();
        foreach(T t in result)
        {
            list.AddFirst(t);
        }
    }

LavaPlayer.Stop disposes of player, documentation labels it as a "Skip" feature

So, it seems that either the documentation or functionality of LavaPlayer.Stop() is incorrect because once you call stop, the player is disposed of and can no longer be used.

Assuming it is supposed to end the current song to allow the next to play, then just removing Volatile.Write(ref IsDisposed, true); should do the trick:

public void Stop()
{
    if (!IsConnected)
        throw new InvalidOperationException("This player isn't connected.");
    // v Remove this line v
    Volatile.Write(ref IsDisposed, true);
    CurrentTrack = null;
    _lavaSocket.SendPayload(new StopPayload(Guild.Id));
}

Suggestion: Make DiscordClient Requirement Optional

Some people don't actually need to create DiscordClient in order to use the Lavalink REST API only - just for searching tracks, not for connecting to a voice channel.

I say, extract an interface that LavaNode will implement - ISearchable which will have the methods: GetTracksAsync, SearchFromYouTube, SearchFromSoundcloud. And Lavalink will have the following method: ISearchable GetSearchableNode(Configuration config = default), which will return an implementation with only the 3 methods above that are only used for search (Lavalink REST API)

[ BUG ] IsPlaying showing wrong value.


Describe the bug/issue.

Sometimes randomly IsPlaying seems to be false even though the player is playing something. Triggered when trying to skip the current track.

Stacktrace / Screenshots

Stacktrace: This operation is invalid since player isn't actually playing anything.

[ BUG ] Stats event doesn't fire


Describe the bug/issue.

[18:41:56 DBG] {"playingPlayers":0,"op":"stats","memory":{"reservable":8573157376,"used":32857352,"free":271229688,"allocated":304087040},"players":0,"cpu":{"cores":16,"systemLoad":0,"lavalinkLoad":0.0684084030621328},"uptime":11861}

The stats event is definitely sent by lavalink but the onstatsevent is never fired by victoria. So smth is breaking there.

 private Task OnStatsReceived(StatsEventArgs e)
        {
            _log.LogTrace("Received Stats from LavaLink");
            _audioStatsService.SetStats(e);
            return Task.CompletedTask;
        }

This event is never triggered.

[ BUG ] NullReferenceException on PlayAsync


Describe the bug/issue.

When calling PlayAsync with a track (which has full information specified), I get a NullReferenceException

Stacktrace / Screenshots

   at Victoria.LavaSocket.<SendAsync>d__23`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Victoria.LavaPlayer.<PlayAsync>d__42.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Asphalt.Modules.Audio.<Play>d__3.MoveNext() in D:\Development\AsphaltV4\Asphalt.Modules\Audio.cs:line 102

Line 102 is await player.PlayAsync(track);

track is the following:
image

This happens on all tracks that I try

System.NullReferenceException in Victoria.Lavalink.<AddNodeAsync>

Hey, i have this build problem:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. in Victoria.Lavalink.d__9.MoveNext()
But this reference isn't null:
var node = await _lavalink.AddNodeAsync(_client);

_client:
private DiscordSocketClient _client; _client = new DiscordSocketClient();
If anyone can help, I appreciate it :)

[ BUG ] Stop streaming audio


Describe the bug/issue.

is there a reason to stop streaming audio? although there is no problem appearing in the console, to fixing this problem must disconnect from Lavalink and reconnect, I think the token of the voice channel is changing and Victoria doesn't send it to WebSocket, This problem has appeared a lot and I have the latest version of Victoria and Lavalink.

Got error while searching youtube song

When i run search code i got this error

Newtonsoft.Json.JsonReaderException
HResult=0x80131500
Message=Error reading JObject from JsonReader. Path '', line 0, position 0.
Source=Newtonsoft.Json
StackTrace:
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json)
at Victoria.LavaRestClient.d__5.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Discord_Bot.Form1.VB$StateMachine_23_Button1_Click.MoveNext() in C:\Users\Huntsman\Documents\Visual Studio 2019\Projects\Discord Bot - Copy\Discord Bot\Form1.vb:line 167

[ BUG ] No connection could be made because the target machine actively refused it


Describe the bug/issue.

Probably the same issue as this user, but I can't figure it out:
#66

When trying to search YouTube, an exception is thrown. Do I need to log in somehow? Is there a standalone executable I need to be running alongside my bot? I'm new to Victoria and LavaLink.

Stacktrace / Screenshots

07:04:50 [Error] Command: Discord.Commands.CommandException: Error occurred executing "play" for Amoo#0001 in Demon Girls/??|bots.
 ---> System.Net.Http.HttpRequestException: No connection could be made because the target machine actively refused it.
 ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at Victoria.LavaNode`1.SearchAsync(String query)
   at DemonGirls.Modules.MusicModule.Play(String query) in C:\Users\Amy\source\repos\DemonGirls\DemonGirls\Modules\MusicModule.cs:line 75
   at Discord.Commands.ModuleClassBuilder.<>c__DisplayClass6_0.<<BuildCommand>g__ExecuteCallback|0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Discord.Commands.CommandInfo.ExecuteInternalAsync(ICommandContext context, Object[] args, IServiceProvider services)
   --- End of inner exception stack trace ---
07:04:50 [Verbose] Command: Executed "play" for Amoo#0001 in Demon Girls/??|bots

[ Feature Request ] voice channel connection options in configuration

It would be interesting to have options in the configuration object like:

  • InactivityMaxTime (TimeSpan) which would refer to how long the connection to a voice channel should be maintained when the bot is not playing anything.
  • DisconnectWhenInactive (bool) which would refer to whether or not the connection should be dropped when we are not playing anything.
  • DisconnectWhenEmpty (bool) which would refer to whether or not a connection to a voice chat should be dropped when the voice channel is populated only by bots or is empty.

[ BUG ] RemoveRange doesn't work properly


Describe the bug/issue.

Calling player.Queue.RemoveRange(0,9) only removes the first 2 entries. To properly do a multi skip i had to use

for (int i = 0; i < queueRemove; i++)
{
    player.Queue.TryDequeue(out _);
}

[ BUG ] "reason":"STOPPED" instead of "reason":"FINISHED"


Describe the bug/issue.

My discord bot has TrackEnded function. This function is triggered by Victoria when a track ends. In this function i have a check like this:

if (!args.Reason.ShouldPlayNext())
          return;

With the latest version of Lavalink when the track ends and the reason is "STOPPED". I downgraded to Lavalink 3.3.1.4 and the reason changed to "FINISHED" (as it should be).
No errors shown in Lavalink.

Stacktrace / Screenshots

With Lavalink 3.3.2.1:
[Victoria] {"op":"event","reason":"STOPPED","type":"TrackEndEvent","track":"","guildId":""}

With Lavalink 3.3.1.4:
[Victoria] {"op":"event","reason":"FINISHED","type":"TrackEndEvent","track":"","guildId":""}

[ PROPOSAL ] Playing from stream


Proposal Description:

Not sure if i need to ask this here.. but here i go :P
Would it be possible to make the player also play music from a memory stream containing byte[] data?
Like for example, i currently use victoria for all my music handling with youtube etc but I also have MP3 files stored as byte data in my database known as 'taunts' (thoose who played age of empires can remember this), but currently i make a temporary file and load that in victoria local.
I messed around with the Mp3FileReader class from naudio and there it is possible to play from a stream but its messy to use and to combine this with victoria becomes pretty messy (currently doing that but ehh)
Could it be possible that Victoria can do something simular as naudio so I can somehow send a stream to the player and it will play it? I would appriciate this a lot

if my suggestion is not clear enough feel free to ask info
have a nice week

[ BUG ] Enqueuing songs cause playing song lag

I have integrated spotify to my music bot, if you go to queue a playlist it will enqueue all the songs but the bot will lag and disconnect.

Is there a way I can enqueue songs but dont download them instantly, so it will download them either at end of song playing or near the end?

[ BUG ] Abnormal Closure (code: 1006) throws WebSocketException


Describe the bug/issue.

At a random time (didn't find any trigger yet) when my music bot is in a voicechannel I get the event Abnormal Closure of type WebSocketClosedEvent. Everytime this event happens I get a WebSocket Exception some time later (in the given log this is ~70min). This gets caught by Discord.NET and a reconnect is initialized. The bot never leaves the channel.
If a music request is asked after this, the bot will accept it but will never output the music stream. Logging shows that lavalink is playing, but still no output from the bot. This throws no new exceptions (DiscordSocketClient log level: Verbose).

I don't know what the triggers before and expected behavior is after I get the Abnormal Closure event. Nor do I know how to catch it and provide a solution/workaround for it.

Feel free to ask for more information. Any information regarding this Abnormale Closure event and how to work with it is much appreciated.

Versions

  • Discord.NET 2.3.0
  • Victoria 5.1.11
  • Lavalink 3.3.2.3

OS: Debian GNU/Linux 10 (buster)

Reproducibility:
Didn't found a trigger yet. Can happens twice in 1 hour, can be 1 time in a week.

Stacktrace / Screenshots

Abnormal closure event log (included some more lines for conveinice)


05:31:03 [Debug] Victoria: {"playingPlayers":0,"op":"stats","memory":{"reservable":2063597568,"used":337347960,"free":18119304,"allocated":355467264},"players":2,"cpu":{"cores":4,"systemLoad":0.06788544593064699,"lavalinkLoad":0.00225},"uptime":434035540}
05:32:03 [Debug] Victoria: {"playingPlayers":0,"op":"stats","memory":{"reservable":2063597568,"used":338154624,"free":17312640,"allocated":355467264},"players":2,"cpu":{"cores":4,"systemLoad":0.059888814016172506,"lavalinkLoad":0.00225},"uptime":434095540}
**05:32:32 [Debug] Victoria: {"op":"event","reason":"Abnormal closure","code":1006,"byRemote":false,"type":"WebSocketClosedEvent","guildId":"307269176202887169"}**
05:33:03 [Debug] Victoria: {"playingPlayers":0,"op":"stats","memory":{"reservable":2063597568,"used":338815952,"free":16651312,"allocated":355467264},"players":2,"cpu":{"cores":4,"systemLoad":0.061317183951551855,"lavalinkLoad":0.00225},"uptime":434155540}
05:34:03 [Debug] Victoria: {"playingPlayers":0,"op":"stats","memory":{"reservable":2063597568,"used":339340296,"free":16126968,"allocated":355467264},"players":2,"cpu":{"cores":4,"systemLoad":0.06012884753042234,"lavalinkLoad":0.00225},"uptime":434215540}

WebSocket Exception + reconnect:

06:41:37 [Warning] Gateway: System.Exception: WebSocket connection was closed
 ---> System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
 ---> System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
	at System.Net.WebSockets.ManagedWebSocket.ThrowIfEOFUnexpected(Boolean throwOnPrematureClosure)
    at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken, Boolean throwOnPrematureClosure)
    at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
    at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
    at Discord.Net.WebSockets.DefaultWebSocketClient.RunAsync(CancellationToken cancelToken)
    --- End of inner exception stack trace ---
    at Discord.ConnectionManager.<>c__DisplayClass29_0.<<StartAsync>b__0>d.MoveNext()
06:41:37 [Info] Gateway: Disconnecting
06:41:37 [Verbose] Gateway: Disconnected from iXD Varia
06:41:37 [Verbose] Gateway: Disconnected from iXD
06:41:37 [Verbose] Gateway: Disconnected from iNTERMiXED
06:41:37 [Info] Gateway: Disconnected
06:41:38 [Info] Gateway: Connecting
06:41:38 [Verbose] Rest: GET gateway: 128.03 ms
06:41:39 [Verbose] Gateway: Connected to iXD Varia
06:41:39 [Info] Gateway: Connected
06:41:39 [Verbose] Gateway: Connected to iXD
06:41:39 [Verbose] Gateway: Connected to iNTERMiXED
06:41:39 [Info] Gateway: Resumed previous session

Lavalink/Victoria logging when a music command is used

07:30:42.035 DEBUG 17445 --- [ XNIO-1 task-24] o.s.web.servlet.DispatcherServlet        : GET "/loadtracks?identifier=ytsearch%3Aspanish+flea", parameters={masked}
07:30:42.062 DEBUG 17445 --- [ XNIO-1 task-24] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public java.util.concurrent.CompletionStage<org.springframework.http.ResponseEntity<java.lang.String>> lavalink.server.player.AudioLoaderRestHandler.getLoadTracks(javax.servlet.http.HttpServletRequest,java.lang.String)
07:30:42.063  INFO 17445 --- [ XNIO-1 task-24] l.server.player.AudioLoaderRestHandler   : Got request to load for identifier "ytsearch:spanish flea"
07:30:42.064 DEBUG 17445 --- [ XNIO-1 task-24] o.s.w.c.request.async.WebAsyncManager    : Started async request
07:30:42.064 DEBUG 17445 --- [ XNIO-1 task-24] o.s.web.servlet.DispatcherServlet        : Exiting but response remains open for further handling
07:30:42.792  INFO 17445 --- [ader-2-thread-1] lavalink.server.player.AudioLoader       : Loaded playlist Search results for: spanish flea
07:30:42.793 DEBUG 17445 --- [ader-2-thread-1] o.s.w.c.request.async.WebAsyncManager    : Async result set, dispatch to /loadtracks
07:30:42.793 DEBUG 17445 --- [ XNIO-1 task-25] o.s.web.servlet.DispatcherServlet        : "ASYNC" dispatch for GET "/loadtracks?identifier=ytsearch%3Aspanish+flea", parameters={masked}
07:30:42.794 DEBUG 17445 --- [ XNIO-1 task-25] s.w.s.m.m.a.RequestMappingHandlerAdapter : Resume with async result [<200 OK OK,{"playlistInfo":{},"loadType":"SEARCH_RESULT","tracks":[{"track":"QAAAfQIAGlNwYW5pc2ggRmx (truncated)...]
07:30:42.794 DEBUG 17445 --- [ XNIO-1 task-25] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/json', given [*/*] and supported [application/json]
07:30:42.794 DEBUG 17445 --- [ XNIO-1 task-25] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Writing ["{"playlistInfo":{},"loadType":"SEARCH_RESULT","tracks":[{"track":"QAAAfQIAGlNwYW5pc2ggRmxlYSAtIEhlc (truncated)...]
07:30:42.810 DEBUG 17445 --- [ XNIO-1 task-25] o.s.web.servlet.DispatcherServlet        : Exiting from "ASYNC" dispatch, status 200
07:30:42.815  INFO 17445 --- [   XNIO-1 I/O-4] lavalink.server.io.SocketServer          : {"endTime":0,"track":"QAAAfQIAGlNwYW5pc2ggRmxlYSAtIEhlcmIgQWxwZXJ0AAlLbGFyIE5hbWUAAAAAAAHsMAALbU1MMmZQZWM3eFUAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1tTUwyZlBlYzd4VQAHeW91dHViZQAAAAAAAAAA","noReplace":false,"startTime":0,"guildId":"307269176202887169","op":"play"}
07:30:42 [Debug] Victoria: {"op":"event","type":"TrackStartEvent","track":"QAAAfQIAGlNwYW5pc2ggRmxlYSAtIEhlcmIgQWxwZXJ0AAlLbGFyIE5hbWUAAAAAAAHsMAALbU1MMmZQZWM3eFUAAQAraHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1tTUwyZlBlYzd4VQAHeW91dHViZQAAAAAAAAAA","guildId":"307269176202887169"}
07:30:42 [Debug] Victoria: {"op":"playerUpdate","state":{"position":0,"time":1616524242815},"guildId":"307269176202887169"}
07:30:42 [Debug] Victoria: {"op":"playerUpdate","state":{"position":0,"time":1616524242815},"guildId":"307269176202887169"}
07:30:43 [Verbose] Rest: POST channels/312940674133655552/messages: 455.64 ms
07:30:43 [Verbose] Command: Executed "Play" for USERNAME in iXD/music
07:30:47 [Debug] Victoria: {"op":"playerUpdate","state":{"position":4200,"time":1616524247815},"guildId":"307269176202887169"}
07:30:52 [Debug] Victoria: {"op":"playerUpdate","state":{"position":9200,"time":1616524252815},"guildId":"307269176202887169"}
07:30:57 [Debug] Victoria: {"op":"playerUpdate","state":{"position":14200,"time":1616524257815},"guildId":"307269176202887169"}

Can't play local .mp3 audio Files

I cant get to play audio files from local file path even tho lavalink should support this. I only got youtube search querys to work. Can somebody help me ? local source is set to true.

[ BUG ] FriendlyException: Something broke while playing the track (YouTube Search)


Describe the bug/issue.

Original:

I was playing from yt and got this error, there is no sound being played.
FriendlyException: Something broke while playing the track

Revised:

When making a YouTube search either via a raw query (!Search The Weeknd Valerie) or passing a direct link (https://youtube.com/watch?v=ABCD1234) search doesn't return anything and Lavalink throws an exception (Screenshot attached below).

This problem is not related to Victoria. If Lavalink isn't able to parse out audio links or if something changed on YouTube's end, Lavalink won't be able to return any results.

Stacktrace / Screenshots

image

Update:

It seems many of you can't find songs on YouTube when using Lavalink. Please know that this is not related to Victoria.

What you need to be on the lookout for:
Lavalink issues: https://github.com/Frederikam/Lavalink/issues
Lavalink CI releases: https://ci.fredboat.com/viewLog.html?buildId=lastSuccessful&buildTypeId=Lavalink_Build&tab=artifacts&guest=1

Please make sure you download and install Lavalink from their CI ^.
Till then please use SoundCloudSearchAsync to search tracks or have a null check before adding your track to queue:

  1. Check if SearchResponse returns null.
  2. Check if searchResponse.LoadStatus returns null or failed or no search.
  3. Check if track collection is empty.
  4. Check if selected track is null (FirstOrDefault)
  5. If all of that returns null, search again and requeue

[ PROPOSAL ] Know the user who queued the track


Proposal Description:

I would like to know who queued the track when getting the tracks. Not sure where the property should be added to, perhaps LavaTrack? not sure about that one

Pseudo Code:

maybe something like
track.QueuedBy

Remember if paused

The player should be able to implement a function to pause/resume with one function, or at least have a variable to keep track if the player has been paused.

[ BUG ] VolumePayload gives a JSON that doesn't work


Describe the bug/issue.

LavaPlayer.cs:188 | var payload = new VolumePayload(VoiceChannel.GuildId, volume);

new VolumePayload gives a JSON that doesn't work

Stacktrace / Screenshots

Lavalink Error
2019-10-26 18:13:19.585 INFO 9920 --- [ XNIO-2 I/O-1] lavalink.server.io.SocketServer : {"guildId":"542599372836438016","op":"volume"}
2019-10-26 18:13:19.696 ERROR 9920 --- [ XNIO-2 I/O-1] lavalink.server.io.SocketServer : Exception while handling websocket message

org.json.JSONException: JSONObject["volume"] not found.

I Added code at line 199 with "File.WriteAllText("data.txt", Encoding.UTF8.GetString(JsonSerializer.SerializeToUtf8Bytes(payload, default)));"

Screenshot of VolumePayload
image

[ HELP ] OnTrackFinished is no longer working for me


Hi,

I am re-doing my bot, and, when I try out the music tools im running in a problem with a specific event. The "OnTrackFinished" event.
Somehow the event "OnTrackFinished" for the LavaSocketClient seems to be no longer working for me.. To make sure, I commented out all code in my method and just put a Console.WriteLine() to see some testing text in console whenever a track is finished but nothing is showing up.
Even when I manually stop the track using my command !stop, the track stops playing but the event does not fire either.
But on the other hand the "Log" event still works... and they both get assigned at the same time like this:

_lavaSocketClient.Log += OnLavaSocketClientLog;
_lavaSocketClient.OnTrackFinished += OnTrackFinishedAsync;

The first one works (Log), but OnTrackFinished doesnt, I am using DI for all this (with AddSingleton) and I set these event methods when the "Ready" event fires from my DiscordSocketClient
Everything else works fine, music runs etc.. but he wont fire the finished event and I am clueless why this is happening.
I tried it on my older bot and the issue seems to be the same, log event works but finished event doesnt.
I also just tried the "StreamMusicBot" from Drax, even in there the event is not been fired.

To test this further I also tried to queue up some songs in all 3 bots, none of them fired the event when the track was done. Am I doing something wrong here, I really need help with this please.
This is the code I use to do the event work:

private async Task OnTrackFinishedAsync(LavaPlayer player, LavaTrack track, TrackEndReason reason)
{
if (!reason.ShouldPlayNext())
return;

        if (!player.Queue.TryDequeue(out var item) || !(item is LavaTrack nextTrack))
        {
            await player.TextChannel.SendMessageAsync("There are no more tracks in the queue.");
            return;
        }

        await player.PlayAsync(nextTrack);
    }

All help is really appriciated, have a nice day.
Greetings

EDIT:
He also seems to be stuck in the "IsPlaying" because whenever a track is done playing, no more sound is been emited but when you try to add a new song, he will queue the song because he thinks he is still playing but he isnt anymore, this is so weird and I dont understand whats happening, sorry if my english is a bit off

[ BUG ] https lavalink server


Describe the bug/issue.

Hi! My Lavalink server is running behind nginx proxy and is configured to use SSL. Currently it's not possible to connect Victoria to secured Lavalink server mostly because of hardcoded http and ws protocols at those lines.

It would've been nice to have a bool variable in configuration in order to use secured protocols.

On top of that (but that's more like a feature request) it would've been great to have a way to configure User-Agent header. It does help a lot when viewing server logs.

I've actually implemented both of those things so if you are okay with those changes I can submit a PR.

Stacktrace / Screenshots

Server response when trying to connect to https Lavalink server.

400 Bad Request
The plain HTTP request was sent to HTTPS port

Client side.

17:34:42 [Error   ] Exception           : System.Net.WebSockets.Client: The server returned status code '400' when status code '101' was expected.
   at System.Net.WebSockets.WebSocketHandle.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)

No connection could be made because the target machine actively refused it

Hello!

I'm trying to make my bot, but when I try to use "lavaNode.SearchYouTubeAsync()" it's returning "No connection could be made because the target machine actively refused it. (127.0.0.1:2333)".

The only parameter that I configured was ".AddLavaNode(x => { x.SelfDeaf = false; });" nothing else.

Do I need to have any kind of service running on my computer or need to setup something else in my code?

Thank you!

[ PROPOSAL ] v5 Feedback and Discussion


Proposal Description:

I'm adding everything in a single project instead of creating 4 different packages for each thing. The original idea was to have 4 projects like so:

  • Victoria.Commons: Contains base classes that will be utilized by Frostbyte and Lavalink.
  • Victoria.Addons: Addons like LyricsHelper/ThumbnailHelper will be here. Along with other lyric scrappers.
  • Victoria.Frostbyte: Will depend on Commons and have classes like FrostClient, FrostPlayer, etc.
  • Victoria.Lavalink Follows Frostbyte design pattern.

Then push an additional package called Victoria that contains all the packages above but then I realized why not just keep it a single project. Makes everything easier.

Now that I've pushed the first commit I wanted to know what kind of design do you've in mind and what things would you like changed, etc before I start writing concrete implementation of base classes.

[ Question ] Why is the default Player volume set to 0?


Describe the bug/issue.

This is more like a question and not a bug. Why is the default Player volume set to 0? If I set it to 100 it sounds the same.

Code:

var player = _lavaNode.GetPlayer(context.Guild);
Console.WriteLine(player.Volume);

[ PROPOSAL ]


Proposal Description:

Is it possible to add to the example, how to DisconnectAsync or DisposeAsync the LavaNode?.

Suggestion: Target the lowest .NET Standard version possible in addition / instead of .NET Core 3.0

.NET Standard is amazing in my opinion, and while it is incredible that you're keeping up with the latest C# 8 and .NET Core 3.0 Preview, I do believe that some people that target different versions would love this library to target the lowest version of .NET Standard, to support as much as .NET different versions as possible.

I'm 90% sure that you will be able to target both .NET Core v3.0 and .NET Standard simultaneously (keep in mind that you'd have to use APIs that are supported in both)!

Adding playlist videos to queue can sometimes glitch

For some reason when downloading a playlist, some videos may be in the right order, some in the wrong order and some videos aren't even added at all. I found that out when I looked at the videos queue count not being equal to the playlist. For example, I tried a playlist with 121 videos, and when I checked the queue length, there were 119 videos. The videos at the start and end of the queue where the same as the playlist videos at the start and end, I even double checked.
This is my code:
`
public async Task PlayList(string query, IVoiceChannel channel, textchannel)
{

        bool isValid = Uri.IsWellFormedUriString(query, UriKind.Absolute);
        if(!isValid)
        {
            return null;
        }
        var player = await _node.ConnectAsync(channel, textchannel);
        
        var result = await _node.GetTracksAsync(query);
        player.Queue.Clear();
        var a = await SearchAsync(query, textchannel, channel);
        int i = 0;
        foreach (var item in result.Tracks)
        {
            if (i != 0)
            {
                player.Queue.Enqueue(item);
            }
            if (i == 0)
            {
                i=1;
            }
           
        }
        
        
        return a;
    }`

SearchAsync is just a method where it gets a track, detects if the queue is empty, and if it is empty, add the track to the queue, then play the track.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.