* Remove template in favor of official samples * Fixed a variable name copy pasta mistake line 35 was _database.GetData() instead of DBService.GetData() * Experimental theme change * Change paragraph, code, heading fonts * Widen viewport * Update DocFX.Plugins.LastModified v1.2.3 * Exclude Discord.API in docs * Add remarks for SocketReaction properties * Add examples for BaseSocketClient.Events * Add additional clarification for some methods * Move IUser and IGuildChannel examples * Clarify several guides samples with notes - Reword TypeReader comment to avoid giving the idea that the sample itself is "obsolete" - Remove CommandException logging comment regarding C#7.0 as the version is now the standard across VS2017 and up - Remove suggestion about handling result in command handler since it is now advised to use CommandExecuted instead + Add additional comment to clarify ctor for DI setup * Add/migrate code examples * Incorporate material design theme License @ https://github.com/ovasquez * Update installation and nightly guide * Fix improper indentations made obvious by the widen viewport * Fix minor grammar issues + Add installation for nightly build using dotnet CLI * Fix nav level indentation * Revise "Your First Bot" article * Merge some paragraphs to avoid clutter while keeping readability * Reword the use of command framework + Add additional warning/note about environment variable * Add additional indent level * Fix indentation text warping * Remove connections sample * Update logging sample Remove redundant part of the sample * Remove mention of RPC * Remove misleading section about commands - Remove command sample from complete snippet * Revise "Your First Bot" command paragraphs * Change wording to hint devs that additional command parser packages may be available, as more and more begin to crop up * Update themes * Add XML docs contribution guidelines Update guidelines * Update CommandExecuted remarks * Fix precondition remarks typo no one saw that ok * Fix permission sample in docfx * Fix IMessageChannel samples * Update docs/_template/light-dark-theme/styles/docfx.vendor.minify.css Co-Authored-By: Still34 <341464@gmail.com> * Update docs/_template/light-dark-theme/styles/material.css Co-Authored-By: Still34 <341464@gmail.com> * Update docs/_template/light-dark-theme/styles/material.css Co-Authored-By: Still34 <341464@gmail.com>
4.3 KiB
uid, title
| uid | title |
|---|---|
| Guides.GettingStarted.Installation | Installing Discord.Net |
Discord.Net Installation
Discord.Net is distributed through the NuGet package manager; the most recommended way for you to install this library. Alternatively, you may also compile this library yourself should you so desire.
Supported Platforms
Discord.Net targets .NET Standard both 1.3 and 2.0; this also means that creating applications using the latest version of .NET Core is the most recommended. If you are bound by Windows-specific APIs or other limitations, you may also consider targeting .NET Framework 4.6.1 or higher.
Warning
Using this library with Mono is not supported until further notice. It is known to have issues with the library's WebSockets implementation and may crash the application upon startup.
Installing with NuGet
Release builds of Discord.Net will be published to the official NuGet feed.
Development builds of Discord.Net, as well as add-ons, will be published to our MyGet feed. See @Guides.GettingStarted.Installation.Nightlies to learn more.
Using Visual Studio
-
Create a new solution for your bot
-
In the Solution Explorer, find the "Dependencies" element under your bot's project
-
Right click on "Dependencies", and select "Manage NuGet packages"
-
In the "Browse" tab, search for
Discord.Net -
Install the
Discord.Netpackage
Using JetBrains Rider
-
Create a new solution for your bot
-
Open the NuGet window (Tools > NuGet > Manage NuGet packages for Solution)
-
In the "Packages" tab, search for
Discord.Net -
Install by adding the package to your project
Using Visual Studio Code
- Create a new project for your bot
- Add
Discord.Netto your*.csproj
[!codeSample .csproj]
Using dotnet CLI
- Launch your terminal
- Navigate to where your
*.csprojis located - Enter
dotnet add package Discord.Net
Compiling from Source
In order to compile Discord.Net, you will need the following:
Using Visual Studio
The .NET Core and Docker workload is required during Visual Studio installation.
Using Command Line
Additional Information
Installing on Unsupported WebSocket Platform
When running any Discord.Net-powered bot on an older operating system (e.g. Windows 7) that does not natively support WebSocket, you may encounter a @System.PlatformNotSupportedException upon connecting.
You may resolve this by either targeting .NET Core 2.1 or later, or by installing one or more custom packages as listed below.
Targeting .NET Core 2.1
- Download the latest .NET Core SDK.
- Create or move your existing project to use .NET Core.
- Modify your
<TargetFramework>tag to at leastnetcoreapp2.1, or by adding the--framework netcoreapp2.1switch when building.
Custom Packages
-
Install or compile the following packages:
Discord.Net.Providers.WS4NetDiscord.Net.Providers.UDPClient(Optional)- This is only required if your bot will be utilizing voice chat.
-
Configure your DiscordSocketClient to use these custom providers over the default ones.
- To do this, set the
WebSocketProviderand the optionalUdpSocketProviderproperties on the DiscordSocketConfig that you are passing into your client.
- To do this, set the
[!code-csharpExample]




