![]() |
VOOZH | about |
dotnet add package Remora.Discord.Gateway --version 13.0.1
NuGet\Install-Package Remora.Discord.Gateway -Version 13.0.1
<PackageReference Include="Remora.Discord.Gateway" Version="13.0.1" />
<PackageVersion Include="Remora.Discord.Gateway" Version="13.0.1" />Directory.Packages.props
<PackageReference Include="Remora.Discord.Gateway" />Project file
paket add Remora.Discord.Gateway --version 13.0.1
#r "nuget: Remora.Discord.Gateway, 13.0.1"
#:package Remora.Discord.Gateway@13.0.1
#addin nuget:?package=Remora.Discord.Gateway&version=13.0.1Install as a Cake Addin
#tool nuget:?package=Remora.Discord.Gateway&version=13.0.1Install as a Cake Tool
This package provides a fully-featured implementation of a Discord gateway client, complete with resume capabilities and user-facing events.
The package consists of two main parts - the client itself, and the event dispatch system. The latter will be familiar to users of the mediator pattern, wherein an intermediate type handles communication between separate objects; in Remora.Discord.Gateway's case, all incoming Discord events are dispatched and executed concurrently with each other, and the user may register responders to handle these events.
Provided you yourself do not inject services with a shared mutable state, all responders are thread-safe and do not require additional synchronization through semaphores or mutexes.
The client is a singleton service by design.
First and foremost, the gateway client must be registered with your dependency injection container.
services.AddDiscordGateway(serviceProvider => GetTokenFromSomewhere(serviceProvider));
Two things to note:
Remora.Discord.API) - this call takes care of all transitive
dependencies itself.After this point, you may inject the gateway client into your own services. In
order to connect and start dispatching events, you must call RunAsync
somewhere, and subsequently either await the task directly or store it for later
use. This task represents the entire lifetime of the gateway client, and will
run until you explicitly request its termination via the cancellation token
passed to this method.
If you wish to explicitly send a gateway command (for example, to update
presence information), you may do so via the SubmitCommand method on the
client. Note that no validations are performed on this command, so you can cause
unexpected termination of your session if the data is malformed or inappropriate
for the current state of the client.
Responders - the types which react to and handle incoming events - are created
by declaring a class that implements one or more instances of the
IResponder<T> interface, and then registering these types with the service
container.
public class MyResponder : IResponder<IMessageCreate>
{
public async Task<Result> RespondAsync
(
IMessageCreate gatewayEvent,
CancellationToken ct = default
)
{
// ...
}
}
...
services.AddResponder<MyResponder>();
There are no restrictions placed on how long an individual responder may run, but you should strive to keep it short in order to avoid thread pool exhaustion.
Responders have no guarantees related to sequential execution, but you are able to sort them into one of three "groups", which do run sequentially to one another.
services.AddResponder<MyResponder>(ResponderGroup.Early); // executes before...
services.AddResponder<MyResponder>(ResponderGroup.Normal); // executes before...
services.AddResponder<MyResponder>(ResponderGroup.Late);
This is useful in cases where two responders to the same event depend on each other in some way.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Remora.Discord.Gateway:
| Package | Downloads |
|---|---|
|
Remora.Discord.Commands
Glue code for using Remora.Commands with Remora.Discord |
|
|
Remora.Discord.Hosting
Implementation of a hosted Discord gateway service for the .NET Generic Host |
|
|
Remora.Discord.Interactivity
Framework for using Discord's interaction-driven message components |
|
|
Remora.Discord.Caching
Caching implementations of Remora.Discord's services |
|
|
Remora.Discord.Extensions
Utilities and components which extend upon Remora.Discord's base resources |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 13.0.1 | 37,993 | 5/24/2025 |
| 13.0.0 | 15,415 | 2/13/2025 |
| 12.0.2 | 51,235 | 5/28/2024 |
| 12.0.1 | 27,112 | 2/5/2024 |
| 12.0.0 | 48,128 | 11/14/2023 |
| 11.1.0 | 30,647 | 7/24/2023 |
| 11.0.7 | 19,686 | 5/11/2023 |
| 11.0.6 | 3,188 | 3/20/2023 |
| 11.0.5 | 3,783 | 1/19/2023 |
| 11.0.4 | 3,171 | 1/10/2023 |
| 11.0.3 | 3,538 | 12/28/2022 |
| 11.0.2 | 6,328 | 12/10/2022 |
| 11.0.1 | 3,940 | 10/30/2022 |
| 11.0.0 | 20,634 | 9/2/2022 |
| 10.1.7 | 3,877 | 8/19/2022 |
| 10.1.6 | 3,713 | 7/28/2022 |
| 10.1.5 | 3,665 | 7/26/2022 |
| 10.1.4 | 3,450 | 7/26/2022 |
| 10.1.3 | 7,653 | 6/29/2022 |
| 10.1.2 | 3,520 | 6/27/2022 |
Update dependencies.