We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Your API told me to send a report.
I started more or less the demo code in a WPF app.
#nullable enable using DiscordRPC; using DiscordRPC.Logging; using System; using System.Threading.Tasks; namespace DiscordCommunication { public class DiscordService : IDisposable { private readonly DiscordRpcClient _client; public DiscordService() { _client = new DiscordRpcClient( "...", -1, new ConsoleLogger() { Level = LogLevel.Warning }, false ); //Subscribe to events _client.OnReady += (sender, e) => { Console.WriteLine("Received Ready from user {0}", e.User.Username); }; _client.OnPresenceUpdate += (sender, e) => { Console.WriteLine("Received Update! {0}", e.Presence); }; //Connect to the RPC _client.Initialize(); //Set the rich presence //Call this as many times as you want and anywhere in your code. _client.SetPresence(new RichPresence() { Details = "Example Project", State = "csharp example", Assets = new Assets() { LargeImageKey = "x", LargeImageText = "x", SmallImageKey = "x" } }); Loop(); } private async void Loop() { try { while (!_client.IsDisposed) { _client.Invoke(); await Task.Delay(1000); } } catch (Exception e) { Console.WriteLine($"OUCH: {e}"); } } public void Dispose() { _client.Dispose(); } } }
Then I left the app running and exited Discord.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Your API told me to send a report.
I started more or less the demo code in a WPF app.
Then I left the app running and exited Discord.
The text was updated successfully, but these errors were encountered: