Closed minisbett closed 3 years ago
have you ensured you have "Game Activity" enabled in your discord settings?
Of course, it works when I initially set it. But when I try to update it it stays the same
Is that the entire code? the client needs to be scoped so it stays within the lifetime of your application. You shouldn't create the client everytime you want to set the presence. Instead, create the client once, and then just call the SetPresence everytime.
(Just making sure since it does implement IDisposable and will dispose of itself once hte scope is left).
Are you able to give the console output please?
Of course not, it's just a summary of what I have. The client is in a static class with methods using it. The program is running. I can show console output later, I'm currently on the way to school
No worries, just trying to knock off easy issues first. Be sure to put it in trace as well so I can see what exactly its doing :)
Trace?
There is no console output.
nvm I didn't know you need to add a logger
=================== SET 1 ===================
INFO: Attempting a new connection
TRACE: Enqueue Command: DiscordRPC.RPC.Commands.PresenceCommand
INFO: RPC Connection Started
TRACE: ============================
TRACE: Assembly: DiscordRPC, Version=1.0.150.0, Culture=neutral, PublicKeyToken=null
TRACE: Pipe: DiscordRPC.IO.ManagedNamedPipeClient
TRACE: Platform: Microsoft Windows NT 6.2.9200.0
TRACE: applicationID: 770355757622755379
TRACE: targetPipe: -1
TRACE: POLL_RATE: 1000
TRACE: _maxRtQueueSize: 512
TRACE: _maxRxQueueSize: 0
TRACE: ============================
TRACE: Connecting to the pipe through the DiscordRPC.IO.ManagedNamedPipeClient
TRACE: ManagedNamedPipeClient.Connection(-1)
TRACE: Connection Attempt 0 ()
INFO: Attempting to connect to discord-ipc-0
TRACE: Waiting for connection...
INFO: Connected to discord-ipc-0
TRACE: Done. Result: False
TRACE: Begining Read of 16384 bytes
TRACE: Connected to the pipe. Attempting to establish handshake...
TRACE: Enqueued Message, but queue size is 0.
TRACE: Attempting to establish a handshake...
TRACE: Sending Handshake...
TRACE: Setting the connection state to CONNECTING
TRACE: Connection Established. Starting reading loop...
TRACE: Ending Read
TRACE: Read 342 bytes
TRACE: Read a frame: Frame
TRACE: Starting another read
TRACE: Begining Read of 16384 bytes
TRACE: Read Payload: Frame
INFO: Handling Response. Cmd: Dispatch, Event: Ready
INFO: Connection established with the RPC
TRACE: Setting the connection state to CONNECTED
TRACE: Enqueued Message, but queue size is 0.
TRACE: Attempting to send payload: SetActivity
TRACE: Sending payload: SetActivity
TRACE: Ending Read
TRACE: Read 397 bytes
TRACE: Read a frame: Frame
TRACE: Starting another read
TRACE: Begining Read of 16384 bytes
TRACE: Sent Successfully.
TRACE: Read Payload: Frame
INFO: Handling Response. Cmd: SetActivity, Event:
TRACE: Enqueued Message, but queue size is 0.
=================== SET 2 ===================
static void Main(string[] args)
{
Console.WriteLine("=================== SET 1 ===================");
Discord.SetPresenceServer("test");
Thread.Sleep(3000);
Console.WriteLine("=================== SET 2 ===================");
Discord.SetPresenceServer("123");
while (true)
;
}
using DiscordRPC;
using DiscordRPC.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Test
{
public static class Discord
{
// The discord RPC client used for the rich presence
// given the app id (see developer portal) and -1 as the pipe for automatic pipe scan
private static DiscordRpcClient m_client = new DiscordRpcClient("", -1, new ConsoleLogger(LogLevel.Trace, true));
// Determines if the presence has been initialized yet
private static bool m_initialized = false;
public static void SetPresenceServer(string name)
{
if (!m_initialized)
{
m_client.Initialize();
RichPresence rp = new RichPresence();
rp.Timestamps = new Timestamps(DateTime.UtcNow);
rp.State = "Currently playing on: " + name;
rp.Details = "Playing osu! on a 3rd-party server using the Ultimate Osu Server Switcher";
rp.Assets = new Assets() { LargeImageKey = "uoss", LargeImageText = "Download on GitHub!\r\nminisbett/ultimate-osu-server-switcher" };
m_client.SetPresence(rp);
m_initialized = true;
}
else
{
m_client.UpdateState("Currently playing on: " + name);
}
}
public static void RemovePresence()
{
if (m_initialized)
m_client.ClearPresence();
}
}
}
Exactly nothing happens, no console output. But in Visual Studio I saw that a thread stopped.
A quick fix would be nice, otherwise this library has no use.
A quick fix would be nice, otherwise this library has no use.
........ excuse me?
I do this for free.. as a hobby. I am very busy IRL and do this in my free time. As you can see, there are a collection of minor issues that need to be resolved and I am currently waiting for Mason to document some more features so I could enhance the library. This bug is on my list and I have been meaning to get around to it. I just dont have the time this week.
This bug doesn't prevent the usage of this library. All the UpdateXXX
functions are purely shortcuts and "Nice to Have" features. I could delete the function and the library would work just the same. Just call SetPresence
again.
If you want it fixed faster, you can submit a PR yourself. Its open source and contribution is welcomed.
Sorry, I didn't want to sound mean, it was more of a wish that a fix would be available soon. I voiced very badly, sorry. I can speak english very well but when it comes to emotions and feelings a sentence tells I often come across wrong.
I will submit a PR, I hope it will be accepted soon
Thank you for creating the issue. This has been fixed hopefully now.
Describe the bug
UpdateState does not update the state on discord.
when I then call
m_client.UpdateState("test");
theCurrentPresence
property updates but it doesn't update on discord.Desktop (please complete the following information):