Lachee / discord-rpc-csharp

C# custom implementation for Discord Rich Presence. Not deprecated and still available!
MIT License
560 stars 94 forks source link

[BUG] RPC dont work #107

Closed GamerClassN7 closed 3 years ago

GamerClassN7 commented 3 years ago

Describe the bug RPC not showing

To Reproduce my code is down below `using DiscordRPC; using DiscordRPC.Logging; using System;

namespace DIscord {

class Program
{
    static void Main(string[] args)
    {

        DiscordRpcClient client = new DiscordRpcClient("");

        client.Logger = new ConsoleLogger() { Level = LogLevel.Warning };

        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);
        };

        client.Initialize();
        while (true)
        {
            if (client.IsInitialized) Console.WriteLine("test");
            client.SetPresence(new RichPresence()
            {
                Details = "Example Project",
                State = "csharp example",
                Assets = new Assets()
            });
        }
        Console.ReadKey();
        Console.WriteLine("Hello World!");
    }
}

} `

Expected behavior show RPC

Desktop (please complete the following information):

can ani body suggest what i am doing wrong ?

Lachee commented 3 years ago

Client ID is missing. Also make sure you have Game Activity enabled in your discord settings img

Additionally your while(true) will take up all your CPU time and basically freeze your application.

GamerClassN7 commented 3 years ago

Thank you! It is working perfectly now 👍