Discord.Addons.SimpleAudio
1.0.0-rc2
This is a prerelease version of Discord.Addons.SimpleAudio.
dotnet add package Discord.Addons.SimpleAudio --version 1.0.0-rc2
NuGet\Install-Package Discord.Addons.SimpleAudio -Version 1.0.0-rc2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Discord.Addons.SimpleAudio" Version="1.0.0-rc2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Discord.Addons.SimpleAudio --version 1.0.0-rc2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Discord.Addons.SimpleAudio, 1.0.0-rc2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Discord.Addons.SimpleAudio as a Cake Addin #addin nuget:?package=Discord.Addons.SimpleAudio&version=1.0.0-rc2&prerelease // Install Discord.Addons.SimpleAudio as a Cake Tool #tool nuget:?package=Discord.Addons.SimpleAudio&version=1.0.0-rc2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Discord.Addons.SimpleAudio
Easy-to-use implementation for playing music with Discord.Net 1.0.
Prerequisites
You need FFMpeg, opus, and libsodium. You can download these
for your platform here.
You need to rename libopus.dll
to opus.dll
before use.
- Add opus and libsodium by right-clicking your project in Solution Explorer → Add → Existing Item. Go to their properties and set them to Copy Always.
Quickstart
- If you want your users to be able to use commands to control the audio player, create a new class to manage those commands.
using Discord.Addons.SimpleAudio;
public class AudioModuleImplementation : AudioModule
{
// Add the [Command] attribute, remember to set all your commands
// in this module to 'Runmode.Async'.
// Add preconditions if you want more granular control.
[Command("join", RunMode = RunMode.Async)]
public override Task JoinCmd(IVoiceChannel target = null)
{
// All you need to do is call the base version
// of the commmand.
return base.JoinCmd(target);
}
}
- During your bot initialization, create an
AudioConfig
object that contains at the very least, the path forffmpeg.exe
and the base path for the music you want to play:
var audioCfg = new AudioConfig(
ffmpegPath: @"C:\ffmpeg-folder\bin\ffmpeg.exe",
musicBasePath: @"C:\bot_music")
{
// You can provide guild-specific configurations
// by using the following property and syntax sugar:
GuildConfigs =
{
// C#6+ syntax
[guildId] = new StandardAudioGuildConfig
{
// Consult IntelliSense for the
// properties you can set here.
AutoPlay = true
}
},
// You can also set some properties globally
// NOTE: If a guild-specific option is specified,
// that takes precedence over the global option.
AutoPlay = false
};
- Finally, add the
AudioService
to your service collection and your module implementation to yourCommandService
:
_serviceCollection.AddSingleton(new AudioService(_client, audioCfg, _logger));
//...
await _commands.AddModuleAsync<AudioModuleImplementation>();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- Discord.Net.Commands (>= 1.0.2)
- Discord.Net.WebSocket (>= 1.0.2)
- System.Memory (>= 4.4.0-preview1-25305-02)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0-rc2 | 990 | 1/17/2018 |