Compare commits
	
		
			6 Commits
		
	
	
		
			v0.10.5
			...
			features/p
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | f14eb8a263 | ||
|   | ac0f6e18ed | ||
|   | 47bffbff7f | ||
|   | fcd376bdcb | ||
|   | a71f65de55 | ||
|   | 97b9514c42 | 
| @@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TomatenMusic", "TomatenMusi | |||||||
| EndProject | EndProject | ||||||
| Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TomatenMusicCore", "TomatenMusicCore\TomatenMusicCore.csproj", "{40B1E82B-656D-413B-B636-EB0AE84391E2}" | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TomatenMusicCore", "TomatenMusicCore\TomatenMusicCore.csproj", "{40B1E82B-656D-413B-B636-EB0AE84391E2}" | ||||||
| EndProject | EndProject | ||||||
|  | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TomatenMusic.Panel", "TomatenMusic.Panel\TomatenMusic.Panel.csproj", "{D138639E-0D85-4D04-99A8-1C14A550C65B}" | ||||||
|  | EndProject | ||||||
| Global | Global | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | 	GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||||||
| 		Debug|Any CPU = Debug|Any CPU | 		Debug|Any CPU = Debug|Any CPU | ||||||
| @@ -27,6 +29,10 @@ Global | |||||||
| 		{40B1E82B-656D-413B-B636-EB0AE84391E2}.Debug|Any CPU.Build.0 = Debug|Any CPU | 		{40B1E82B-656D-413B-B636-EB0AE84391E2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||||
| 		{40B1E82B-656D-413B-B636-EB0AE84391E2}.Release|Any CPU.ActiveCfg = Release|Any CPU | 		{40B1E82B-656D-413B-B636-EB0AE84391E2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||||
| 		{40B1E82B-656D-413B-B636-EB0AE84391E2}.Release|Any CPU.Build.0 = Release|Any CPU | 		{40B1E82B-656D-413B-B636-EB0AE84391E2}.Release|Any CPU.Build.0 = Release|Any CPU | ||||||
|  | 		{D138639E-0D85-4D04-99A8-1C14A550C65B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||||||
|  | 		{D138639E-0D85-4D04-99A8-1C14A550C65B}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||||||
|  | 		{D138639E-0D85-4D04-99A8-1C14A550C65B}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||||||
|  | 		{D138639E-0D85-4D04-99A8-1C14A550C65B}.Release|Any CPU.Build.0 = Release|Any CPU | ||||||
| 	EndGlobalSection | 	EndGlobalSection | ||||||
| 	GlobalSection(SolutionProperties) = preSolution | 	GlobalSection(SolutionProperties) = preSolution | ||||||
| 		HideSolutionNode = FALSE | 		HideSolutionNode = FALSE | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								TomatenMusic.Panel/ServerPanel.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								TomatenMusic.Panel/ServerPanel.cs
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | namespace TomatenMusic.Panel | ||||||
|  | { | ||||||
|  |     public class ServerPanel | ||||||
|  |     { | ||||||
|  |  | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								TomatenMusic.Panel/TomatenMusic.Panel.csproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								TomatenMusic.Panel/TomatenMusic.Panel.csproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | |||||||
|  | <Project Sdk="Microsoft.NET.Sdk"> | ||||||
|  |  | ||||||
|  |   <PropertyGroup> | ||||||
|  |     <TargetFramework>net6.0</TargetFramework> | ||||||
|  |     <ImplicitUsings>enable</ImplicitUsings> | ||||||
|  |     <Nullable>enable</Nullable> | ||||||
|  |   </PropertyGroup> | ||||||
|  |  | ||||||
|  |   <ItemGroup> | ||||||
|  |     <ProjectReference Include="..\TomatenMusicCore\TomatenMusicCore.csproj" /> | ||||||
|  |   </ItemGroup> | ||||||
|  |  | ||||||
|  | </Project> | ||||||
| @@ -5,10 +5,6 @@ | |||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|     <ImplicitUsings>enable</ImplicitUsings> |     <ImplicitUsings>enable</ImplicitUsings> | ||||||
|     <RootNamespace>TomatenMusic_Api</RootNamespace> |     <RootNamespace>TomatenMusic_Api</RootNamespace> | ||||||
|     <RestoreAdditionalProjectSources> |  | ||||||
|       https://api.nuget.org/v3/index.json; |  | ||||||
|       https://nuget.emzi0767.com/api/v3/index.json |  | ||||||
|     </RestoreAdditionalProjectSources> |  | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|   | |||||||
| @@ -89,17 +89,12 @@ namespace TomatenMusic.Music | |||||||
|             MusicActionResponse response; |             MusicActionResponse response; | ||||||
|             try |             try | ||||||
|             { |             { | ||||||
|                 response = PlayerQueue.NextTrack(true); |                 response = PlayerQueue.NextTrack(true, Autoplay); | ||||||
|             }catch (Exception ex) |             }catch (Exception ex) | ||||||
|             { |             { | ||||||
|                 if (Autoplay) |                 if (Autoplay) | ||||||
|                 { |                 { | ||||||
|                     YoutubeService youtube = TomatenMusicBot.ServiceProvider.GetRequiredService<YoutubeService>(); |                     _ = OnAutoPlay(CurrentTrack); | ||||||
|                     LavalinkTrack newTrack = await youtube.GetRelatedTrackAsync(CurrentTrack.TrackIdentifier, PlayerQueue.PlayedTracks.Take(5).ToList().ConvertAll(x => x.TrackIdentifier)); |  | ||||||
|  |  | ||||||
|                     _logger.LogInformation($"Skipped Track {CurrentTrack.Title} for Autoplayed Track {newTrack.Title}"); |  | ||||||
|                     await PlayAsync(newTrack); |  | ||||||
|                     QueuePrompt.UpdateFor(GuildId); |  | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|                 throw ex; |                 throw ex; | ||||||
| @@ -164,10 +159,16 @@ namespace TomatenMusic.Music | |||||||
|  |  | ||||||
|             if (channel.Type == ChannelType.Stage) |             if (channel.Type == ChannelType.Stage) | ||||||
|             { |             { | ||||||
|                 DiscordStageInstance stageInstance = await channel.GetStageInstanceAsync(); |                 DiscordStageInstance stageInstance; | ||||||
|  |                 try | ||||||
|  |                 { | ||||||
|  |                     stageInstance = await channel.GetStageInstanceAsync(); | ||||||
|  |  | ||||||
|                 if (stageInstance == null) |                 }catch (Exception ex) | ||||||
|  |                 { | ||||||
|                     stageInstance = await channel.CreateStageInstanceAsync("Music"); |                     stageInstance = await channel.CreateStageInstanceAsync("Music"); | ||||||
|  |                 } | ||||||
|  |                  | ||||||
|                 await stageInstance.Channel.UpdateCurrentUserVoiceStateAsync(false); |                 await stageInstance.Channel.UpdateCurrentUserVoiceStateAsync(false); | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -203,7 +204,6 @@ namespace TomatenMusic.Music | |||||||
|         public async override Task OnTrackEndAsync(TrackEndEventArgs eventArgs) |         public async override Task OnTrackEndAsync(TrackEndEventArgs eventArgs) | ||||||
|         { |         { | ||||||
|             DisconnectOnStop = false; |             DisconnectOnStop = false; | ||||||
|             YoutubeService youtube = TomatenMusicBot.ServiceProvider.GetRequiredService<YoutubeService>(); |  | ||||||
|             var oldTrack = CurrentTrack; |             var oldTrack = CurrentTrack; | ||||||
|  |  | ||||||
|             if (eventArgs.Reason != TrackEndReason.Finished) |             if (eventArgs.Reason != TrackEndReason.Finished) | ||||||
| @@ -226,17 +226,28 @@ namespace TomatenMusic.Music | |||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|  |  | ||||||
|                     TomatenMusicTrack newTrack = await youtube.GetRelatedTrackAsync(oldTrack.TrackIdentifier, PlayerQueue.PlayedTracks.Take(5).ToList().ConvertAll(x => x.TrackIdentifier)); |  | ||||||
|                     _logger.LogInformation($"Autoplaying for track {oldTrack.TrackIdentifier} with Track {newTrack.TrackIdentifier}"); |  | ||||||
|                     await base.OnTrackEndAsync(eventArgs); |                     await base.OnTrackEndAsync(eventArgs); | ||||||
|  |                     _ = OnAutoPlay(oldTrack); | ||||||
|  |  | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |              | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         public async Task OnAutoPlay(LavalinkTrack oldTrack) | ||||||
|  |         { | ||||||
|  |             YoutubeService youtube = TomatenMusicBot.ServiceProvider.GetRequiredService<YoutubeService>(); | ||||||
|  |  | ||||||
|  |             TomatenMusicTrack newTrack; | ||||||
|  |             if (oldTrack.Provider != StreamProvider.YouTube) | ||||||
|  |                 newTrack = await youtube.GetRelatedTrackAsync(PlayerQueue.PlayedTracks.First(x => x.Provider == StreamProvider.YouTube).TrackIdentifier, PlayerQueue.PlayedTracks.Take(5).ToList().ConvertAll(x => x.TrackIdentifier)); | ||||||
|  |             else | ||||||
|  |                 newTrack = await youtube.GetRelatedTrackAsync(oldTrack.TrackIdentifier, PlayerQueue.PlayedTracks.Take(5).ToList().ConvertAll(x => x.TrackIdentifier)); | ||||||
|  |             _logger.LogInformation($"Autoplaying for track {oldTrack.TrackIdentifier} with Track {newTrack.TrackIdentifier}"); | ||||||
|             PlayerQueue.LastTrack = newTrack; |             PlayerQueue.LastTrack = newTrack; | ||||||
|                     await newTrack.Play(this); |             await newTrack.PlayNow(this, withoutQueuePrepend: true); | ||||||
|             QueuePrompt.UpdateFor(GuildId); |             QueuePrompt.UpdateFor(GuildId); | ||||||
|  |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|              |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public async Task<DiscordChannel> GetChannelAsync() |         public async Task<DiscordChannel> GetChannelAsync() | ||||||
|   | |||||||
| @@ -92,9 +92,10 @@ namespace TomatenMusic.Music | |||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public MusicActionResponse NextTrack(bool ignoreLoop = false) |         public MusicActionResponse NextTrack(bool ignoreLoop = false, bool autoplay = false) | ||||||
|         { |         { | ||||||
|             if (LastTrack != null) |             if (LastTrack != null) | ||||||
|  |                 if (LoopType != LoopType.NONE && Queue.Count == 0 || autoplay) | ||||||
|                     PlayedTracks = new Queue<TomatenMusicTrack>(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero)))); |                     PlayedTracks = new Queue<TomatenMusicTrack>(PlayedTracks.Prepend(new TomatenMusicTrack(LastTrack.WithPosition(TimeSpan.Zero)))); | ||||||
|  |  | ||||||
|             switch (LoopType) |             switch (LoopType) | ||||||
| @@ -157,8 +158,7 @@ namespace TomatenMusic.Music | |||||||
|  |  | ||||||
|             if (type == LoopType.QUEUE) |             if (type == LoopType.QUEUE) | ||||||
|             { |             { | ||||||
|                 QueueLoopList = new List<TomatenMusicTrack>(Queue); |                 QueueLoopList = new List<TomatenMusicTrack>(QueueLoopList.Prepend(LastTrack)); | ||||||
|                 QueueLoopList.Add(LastTrack); |  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -98,7 +98,10 @@ namespace TomatenMusic.Prompt.Implementation | |||||||
|                         await Player.RewindAsync(); |                         await Player.RewindAsync(); | ||||||
|                     }catch (Exception ex) |                     }catch (Exception ex) | ||||||
|                     { |                     { | ||||||
|  |                         _ = args.Interaction.CreateResponseAsync( | ||||||
|  |                             DSharpPlus.InteractionResponseType.ChannelMessageWithSource, | ||||||
|  |                             new DiscordInteractionResponseBuilder() | ||||||
|  |                             .WithContent($"An Error occurred during this Interaction {ex.Message}")); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -131,9 +134,19 @@ namespace TomatenMusic.Prompt.Implementation | |||||||
|                         _ = args.Interaction.EditOriginalResponseAsync(new DiscordWebhookBuilder().WithContent("Please connect to the bots Channel to use this Interaction")); |                         _ = args.Interaction.EditOriginalResponseAsync(new DiscordWebhookBuilder().WithContent("Please connect to the bots Channel to use this Interaction")); | ||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|  |                     try | ||||||
|  |                     { | ||||||
|                         await Player.SkipAsync(); |                         await Player.SkipAsync(); | ||||||
|  |  | ||||||
|  |                     } | ||||||
|  |                     catch (Exception ex) | ||||||
|  |                     { | ||||||
|  |                         _ = args.Interaction.CreateResponseAsync( | ||||||
|  |                             DSharpPlus.InteractionResponseType.ChannelMessageWithSource, | ||||||
|  |                             new DiscordInteractionResponseBuilder() | ||||||
|  |                             .WithContent($"An Error occurred during this Interaction {ex.Message}")); | ||||||
|  |                     } | ||||||
|  |  | ||||||
|                     System.Timers.Timer timer = new System.Timers.Timer(800); |                     System.Timers.Timer timer = new System.Timers.Timer(800); | ||||||
|                     timer.Elapsed += (s, args) => |                     timer.Elapsed += (s, args) => | ||||||
|                     { |                     { | ||||||
|   | |||||||
| @@ -4,17 +4,13 @@ | |||||||
|     <TargetFramework>net6.0</TargetFramework> |     <TargetFramework>net6.0</TargetFramework> | ||||||
|     <ImplicitUsings>enable</ImplicitUsings> |     <ImplicitUsings>enable</ImplicitUsings> | ||||||
|     <Nullable>enable</Nullable> |     <Nullable>enable</Nullable> | ||||||
|     <RestoreAdditionalProjectSources> |  | ||||||
|       https://api.nuget.org/v3/index.json; |  | ||||||
|       https://nuget.emzi0767.com/api/v3/index.json |  | ||||||
|     </RestoreAdditionalProjectSources> |  | ||||||
|   </PropertyGroup> |   </PropertyGroup> | ||||||
|  |  | ||||||
| 	<ItemGroup> | 	<ItemGroup> | ||||||
| 		<PackageReference Include="DSharpPlus" Version="4.2.0-nightly-01101" /> | 		<PackageReference Include="DSharpPlus" Version="4.2.0-nightly-01107" /> | ||||||
| 		<PackageReference Include="DSharpPlus.Interactivity" Version="4.2.0-nightly-01101" /> | 		<PackageReference Include="DSharpPlus.Interactivity" Version="4.2.0-nightly-01107" /> | ||||||
| 		<PackageReference Include="DSharpPlus.SlashCommands" Version="4.2.0-nightly-01101" /> | 		<PackageReference Include="DSharpPlus.SlashCommands" Version="4.2.0-nightly-01107" /> | ||||||
| 		<PackageReference Include="Google.Apis.YouTube.v3" Version="1.56.0.2630" /> | 		<PackageReference Include="Google.Apis.YouTube.v3" Version="1.57.0.2637" /> | ||||||
| 		<PackageReference Include="HtmlAgilityPack" Version="1.11.42" /> | 		<PackageReference Include="HtmlAgilityPack" Version="1.11.42" /> | ||||||
| 		<PackageReference Include="Lavalink4NET" Version="2.1.1" /> | 		<PackageReference Include="Lavalink4NET" Version="2.1.1" /> | ||||||
| 		<PackageReference Include="Lavalink4NET.DSharpPlus" Version="2.1.1" /> | 		<PackageReference Include="Lavalink4NET.DSharpPlus" Version="2.1.1" /> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user