Lachee / discord-rpc-csharp

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

RPC Not Working #189

Closed MillzyDev closed 2 years ago

MillzyDev commented 2 years ago

I've set up the client as shown in the docs, however it doesn't seem to be working; nothing show's up on discord for it.

public static class RichPresence
{
    private static readonly DiscordRpcClient s_client;

    static RichPresence()
    {
        Logger.LogInfo("Initialising Rich Presence client instance");

        s_client = new DiscordRpcClient("970748764358864997", -1, new DiscordLogger(), false);

        s_client.OnReady += OnReady;
        s_client.OnPresenceUpdate += OnPresenceUpdate;

        s_client.Initialize();

        s_client.SetPresence(new DiscordRichPresence()
        {
            Timestamps = new Timestamps(DateTime.Now),
            Assets = new Assets()
            {
                LargeImageKey = "icon"
            }
        });
    }

    public static DiscordRpcClient Client { get => s_client; }

    private static void OnReady(object sender, ReadyMessage args)
    {
        Logger.LogInfo($"Recieved 'Ready' from user: {args.User}");
    }

    private static void OnPresenceUpdate(object sender, PresenceMessage args)
    {
        Logger.LogInfo($"Recieved 'Update': {args.Presence}");
    }
}
Lachee commented 2 years ago

uuh why are you doing this all statically?

Please follow the provided GitHub issue templates when reporting a bug. I need a log history and some important information about your setup to properly give support.

Issue is closed, but feel free to open a new one with the valid issue template 👍 Feel free to reference this issue in the new one for future users ( hello future users o/ )