Music Library

This commit is contained in:
2022-04-09 09:06:54 +03:00
parent cbd835c243
commit 3d4c9ae9ea
12 changed files with 308 additions and 21 deletions

Binary file not shown.

View File

@@ -0,0 +1,268 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v5.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v5.0": {
"MusicCommands/1.0.0": {
"dependencies": {
"PluginManager": "1.0.0"
},
"runtime": {
"MusicCommands.dll": {}
}
},
"Discord.Net/3.1.0": {
"dependencies": {
"Discord.Net.Commands": "3.1.0",
"Discord.Net.Core": "3.1.0",
"Discord.Net.Interactions": "3.1.0",
"Discord.Net.Rest": "3.1.0",
"Discord.Net.WebSocket": "3.1.0",
"Discord.Net.Webhook": "3.1.0"
}
},
"Discord.Net.Commands/3.1.0": {
"dependencies": {
"Discord.Net.Core": "3.1.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Commands.dll": {
"assemblyVersion": "3.1.0.0",
"fileVersion": "3.1.0.0"
}
}
},
"Discord.Net.Core/3.1.0": {
"dependencies": {
"Newtonsoft.Json": "13.0.1",
"System.Collections.Immutable": "5.0.0",
"System.Interactive.Async": "5.0.0",
"System.ValueTuple": "4.5.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Core.dll": {
"assemblyVersion": "3.1.0.0",
"fileVersion": "3.1.0.0"
}
}
},
"Discord.Net.Interactions/3.1.0": {
"dependencies": {
"Discord.Net.Core": "3.1.0",
"Discord.Net.Rest": "3.1.0",
"Discord.Net.WebSocket": "3.1.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "5.0.0",
"System.Collections.Immutable": "5.0.0",
"System.Reactive": "5.0.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Interactions.dll": {
"assemblyVersion": "3.1.0.0",
"fileVersion": "3.1.0.0"
}
}
},
"Discord.Net.Rest/3.1.0": {
"dependencies": {
"Discord.Net.Core": "3.1.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Rest.dll": {
"assemblyVersion": "3.1.0.0",
"fileVersion": "3.1.0.0"
}
}
},
"Discord.Net.Webhook/3.1.0": {
"dependencies": {
"Discord.Net.Core": "3.1.0",
"Discord.Net.Rest": "3.1.0"
},
"runtime": {
"lib/net5.0/Discord.Net.Webhook.dll": {
"assemblyVersion": "3.1.0.0",
"fileVersion": "3.1.0.0"
}
}
},
"Discord.Net.WebSocket/3.1.0": {
"dependencies": {
"Discord.Net.Core": "3.1.0",
"Discord.Net.Rest": "3.1.0"
},
"runtime": {
"lib/net5.0/Discord.Net.WebSocket.dll": {
"assemblyVersion": "3.1.0.0",
"fileVersion": "3.1.0.0"
}
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.20.51904"
}
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"System.Collections.Immutable/5.0.0": {},
"System.Interactive.Async/5.0.0": {
"dependencies": {
"System.Linq.Async": "5.0.0"
},
"runtime": {
"lib/netcoreapp3.1/System.Interactive.Async.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.0.1"
}
}
},
"System.Linq.Async/5.0.0": {
"runtime": {
"lib/netcoreapp3.1/System.Linq.Async.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.0.1"
}
}
},
"System.Reactive/5.0.0": {
"runtime": {
"lib/net5.0/System.Reactive.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.0.1"
}
}
},
"System.ValueTuple/4.5.0": {},
"PluginManager/1.0.0": {
"dependencies": {
"Discord.Net": "3.1.0"
},
"runtime": {
"PluginManager.dll": {}
}
}
}
},
"libraries": {
"MusicCommands/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Discord.Net/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-GAY7d+k8UN5BsObGpysvg7ca6YwTqvesTouM8S8eBWSmwGnK38iceVkURg0QNAG70tlJ4w8S/BOjocRRvXU2MQ==",
"path": "discord.net/3.1.0",
"hashPath": "discord.net.3.1.0.nupkg.sha512"
},
"Discord.Net.Commands/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-EZdtrAqj6Uspyz4CvIwFP/UQ4XUpXjIPG1b5LrfAKOo12ks4k6XO7up2h+UsHexk7mEz4sfZxkEXGrW6PSh+/Q==",
"path": "discord.net.commands/3.1.0",
"hashPath": "discord.net.commands.3.1.0.nupkg.sha512"
},
"Discord.Net.Core/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-Oxz3CiWVvenSaHRYZeCKgRqzcWqdjGYmpxVVN2vPikt6bTN+xHAR4jczk8plKDDdINt7Lac37iLsRaqzUtJZpQ==",
"path": "discord.net.core/3.1.0",
"hashPath": "discord.net.core.3.1.0.nupkg.sha512"
},
"Discord.Net.Interactions/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-XzLChVRQGniUU8kdLMDYEOjifzvrcsOiAdKm/pO/PGPpZSMWSzPWlJUWaQlWMtOImrYULzRejOeoc2/3K3R30Q==",
"path": "discord.net.interactions/3.1.0",
"hashPath": "discord.net.interactions.3.1.0.nupkg.sha512"
},
"Discord.Net.Rest/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-97kdAYjlNuuOnhRQW/OoGK2oBObvpzZlCSPJjIcI4DneEq6k2WIFhG00fvxK7DCVTlB5BgBMAT1BeRUk4/rUxQ==",
"path": "discord.net.rest/3.1.0",
"hashPath": "discord.net.rest.3.1.0.nupkg.sha512"
},
"Discord.Net.Webhook/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-cZFxFf9H3GUBITlx1b7IskglgjJxSYpOIZOtyVW2WnPp7LpnxlOi1piRG22fH9fdhCC/RyDx3gZtYfN6WzacCw==",
"path": "discord.net.webhook/3.1.0",
"hashPath": "discord.net.webhook.3.1.0.nupkg.sha512"
},
"Discord.Net.WebSocket/3.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-6OsLNXHNKC/laDKoBD+T0Km0vzqHaCcBOaI/NA8Qsed935MtEOTy7juorF22gF6TYOeoclUgSINrHCY4zWvxpA==",
"path": "discord.net.websocket/3.1.0",
"hashPath": "discord.net.websocket.3.1.0.nupkg.sha512"
},
"Microsoft.Extensions.DependencyInjection.Abstractions/5.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ORj7Zh81gC69TyvmcUm9tSzytcy8AVousi+IVRAI8nLieQjOFryRusSFh7+aLk16FN9pQNqJAiMd7BTKINK0kA==",
"path": "microsoft.extensions.dependencyinjection.abstractions/5.0.0",
"hashPath": "microsoft.extensions.dependencyinjection.abstractions.5.0.0.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"System.Collections.Immutable/5.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
"path": "system.collections.immutable/5.0.0",
"hashPath": "system.collections.immutable.5.0.0.nupkg.sha512"
},
"System.Interactive.Async/5.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-QaqhQVDiULcu4vm6o89+iP329HcK44cETHOYgy/jfEjtzeFy0ZxmuM7nel9ocjnKxEM4yh1mli7hgh8Q9o+/Iw==",
"path": "system.interactive.async/5.0.0",
"hashPath": "system.interactive.async.5.0.0.nupkg.sha512"
},
"System.Linq.Async/5.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-cPtIuuH8TIjVHSi2ewwReWGW1PfChPE0LxPIDlfwVcLuTM9GANFTXiMB7k3aC4sk3f0cQU25LNKzx+jZMxijqw==",
"path": "system.linq.async/5.0.0",
"hashPath": "system.linq.async.5.0.0.nupkg.sha512"
},
"System.Reactive/5.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
"path": "system.reactive/5.0.0",
"hashPath": "system.reactive.5.0.0.nupkg.sha512"
},
"System.ValueTuple/4.5.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ==",
"path": "system.valuetuple/4.5.0",
"hashPath": "system.valuetuple.4.5.0.nupkg.sha512"
},
"PluginManager/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,17 +0,0 @@
using Discord;
using Discord.Audio;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CMD_Utils.Music
{
internal static class Data
{
internal static IAudioClient audioClient;
internal static IVoiceChannel voiceChannel;
}
}

View File

@@ -17,9 +17,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_LevelingSystem", "CMD_L
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EVE_LevelingSystem", "EVE_LevelingSystem\EVE_LevelingSystem.csproj", "{1C1E7F3D-E05A-4A87-9789-62D98904C200}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartupEvents", "StartupEvents\StartupEvents.csproj", "{CE9DBF06-38A0-4192-8B3E-4009210D040D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StartupEvents", "StartupEvents\StartupEvents.csproj", "{CE9DBF06-38A0-4192-8B3E-4009210D040D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CMD_Utils", "CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CMD_Utils", "CMD_Utils\CMD_Utils.csproj", "{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MusicCommands", "MusicCommands\MusicCommands.csproj", "{B1B4976E-5112-4217-B57B-3A03C5207B6E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -51,6 +53,10 @@ Global
{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E26C87A4-3DD6-4B58-B14B-C8E086B852F9}.Release|Any CPU.Build.0 = Release|Any CPU
{B1B4976E-5112-4217-B57B-3A03C5207B6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B1B4976E-5112-4217-B57B-3A03C5207B6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B1B4976E-5112-4217-B57B-3A03C5207B6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B1B4976E-5112-4217-B57B-3A03C5207B6E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -62,6 +68,7 @@ Global
{1C1E7F3D-E05A-4A87-9789-62D98904C200} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
{CE9DBF06-38A0-4192-8B3E-4009210D040D} = {A290C028-77C4-4D1D-AB43-DDFE6ABD9012}
{E26C87A4-3DD6-4B58-B14B-C8E086B852F9} = {449FA364-0B72-43FF-B3A3-806E2916200E}
{B1B4976E-5112-4217-B57B-3A03C5207B6E} = {449FA364-0B72-43FF-B3A3-806E2916200E}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3FB3C5DE-ED21-4D2E-ABDD-3A00EE4A2FFF}

11
MusicCommands/Data.cs Normal file
View File

@@ -0,0 +1,11 @@
using Discord;
using Discord.Audio;
namespace CMD_Utils.Music
{
internal static class Data
{
internal static IAudioClient audioClient = null;
internal static IVoiceChannel voiceChannel = null;
}
}

View File

@@ -27,8 +27,11 @@ namespace CMD_Utils.Music
public async void Execute(SocketCommandContext context, SocketMessage message, DiscordSocketClient client, bool isDM)
{
await Data.audioClient.StopAsync();
await Data.voiceChannel.DisconnectAsync();
if (Data.audioClient is not null && Data.voiceChannel is not null)
{
await Data.audioClient.StopAsync();
await Data.voiceChannel.DisconnectAsync();
}
}
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>../BUILDS/</OutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\PluginManager\PluginManager.csproj" />
</ItemGroup>
</Project>