Skip to content
New issue

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

SetPresence doesn't work for updating? #84

Open
Freakyygg opened this issue Feb 26, 2020 · 19 comments
Open

SetPresence doesn't work for updating? #84

Freakyygg opened this issue Feb 26, 2020 · 19 comments
Assignees
Labels
question Further information is requested

Comments

@Freakyygg
Copy link

Freakyygg commented Feb 26, 2020

Hey,

So at the init of my form I am calling all the needed functions to get the RPC which works perfectly.
After some time on a click event of a button I want to update the RPC but this doesn't work :/

I also tried the client.UpdateState("Test"); for example, this deons't work either.

Here is my current code to update the RPC:
client.SetPresence(new RichPresence() { Details = "Playing against ", State = EnemyTeamName, Assets = new Assets() { LargeImageKey = "1000x1000", LargeImageText = "Opportunity League"//, //SmallImageKey = "image_small", //SmallImageText = "Test" }, Timestamps = new Timestamps() { Start = DateTime.UtcNow } });

Hopefully you can help me
Best Regards

@Lachee
Copy link
Owner

Lachee commented Feb 26, 2020

"doesn't work" isnt an issue. Its a symptom. Please provide error messages or displayed behaviour so I can debug this faster.

Additionally, please enable the logging of the client and set to Info or Trace. Log out the messages when you are trying to set the presence and share here. This will show if the presence is actually being set via discord.

Lastly, please give the framework (mono, .net fx w/ winfom, .net core etc) as well as the package version of discord-rpc-csharp so I can rule out any platform specific issues.

I see you have gone against my issue guidelines. Please follow the format provided when creating new issues in the future.

@Lachee Lachee added the question Further information is requested label Feb 28, 2020
@Razeal
Copy link

Razeal commented Mar 26, 2020

Hello,

I'm experiencing the same issue when using it with Unity 2019.2.11f1, scripting backend is Mono with .NET 4.x

Package version is latest stable 1.0.150

As for the behaviour and logs, it behaves the same both in the Editor and with a debug build.
In which it works just fine for the first presence update and then gets stuck on a message enqueue.
After the final enqueue message it wouldn't react to any update I'm trying to push and nothing is logged either.

I've attached the logs, this was with log level trace.

rcp.log

@Lachee Lachee self-assigned this Mar 27, 2020
@Lachee Lachee added the bug Something isn't working label Mar 27, 2020
@Lachee
Copy link
Owner

Lachee commented Mar 27, 2020

Thank you for the logs. I will investigate this over the weekend and hopefully update the Unity package (its fairly out of date actually).

I will comment back here when done so be sure to watch this thread :)

@LandDeckTeam
Copy link

LandDeckTeam commented Apr 8, 2020

It's not repaired yet (at least for Visual Studio NuGet). Please update it

EDIT: Is there any other way you can update the presence?

@Lachee
Copy link
Owner

Lachee commented Apr 8, 2020

It's not repaired yet (at least for Visual Studio NuGet). Please update it

EDIT: Is there any other way you can update the presence?

There shouldn't be any issue with the visual studio version. This bug is only for the Unity Editor.

@LandDeckTeam
Copy link

LandDeckTeam commented Apr 8, 2020

Well... no, it does not work with SetPresence() on Visual Studio (Unless I am an idiot :D).
And I have 2 more questions:
Is there any way or are yuo planning to add time stampt (I mean the timer)?
Is there any way or are yuo planning to add player count (I mean the thing that shows ex. 1 of 5)?

EDIT: now I know how to make timer

@Lachee
Copy link
Owner

Lachee commented Apr 8, 2020

Well... no, it does not work with SetPresence() on Visual Studio (Unless I am an idiot :D).
And I have 2 more questions:
Is there any way or are yuo planning to add time stampt (I mean the timer)?
Is there any way or are yuo planning to add player count (I mean the thing that shows ex. 1 of 5)?

EDIT: now I know how to make timer

1: Please make a proper bug report. I will not respond to "it no work".
2: No, there are timestamp data structures already (you seem to have found them)
3: Player count already exists, you need to set the Party. The fields are Size and Max.

@M1XT3NZ
Copy link

M1XT3NZ commented Apr 8, 2020

Well... no, it does not work with SetPresence() on Visual Studio (Unless I am an idiot :D).
And I have 2 more questions:
Is there any way or are yuo planning to add time stampt (I mean the timer)?
Is there any way or are yuo planning to add player count (I mean the thing that shows ex. 1 of 5)?

EDIT: now I know how to make timer

It does work. Please reread your code and see if its actually correct,
just used the example code on the main page, It does work.
Maybe you didnt add your application id to
"client = new DiscordRpcClient("");" ?

Send your code maybe you just made a little mistake.

@LandDeckTeam
Copy link

LandDeckTeam commented Apr 8, 2020

Thanks, and sorry for before.
Here is my code:

public void Initialize()
		{
			client = new DiscordRpcClient(textBox1.Text);
			client.OnReady += (sender, e) =>
			{
				//richTextBox1.AppendText("Received Ready from user " + e.User.Username);
				Console.WriteLine("User {0}", e.User.Username);
			};

			client.OnPresenceUpdate += (sender, e) =>
			{
				//richTextBox1.AppendText("Received Update! {0}" + e.Presence);
				Console.WriteLine("Update! {0}", e.Presence);
			};
			client.Initialize();
			client.SetPresence(new RichPresence()
			{
				Details = textBox2.Text,
				State = textBox3.Text,
				Assets = new Assets()
				{
					LargeImageKey = "large",
					LargeImageText = "Download from: juzio520.webd.pro/youtubeviewer"
					//SmallImageKey = "image_small"
				},
				Timestamps = new Timestamps()
				{
					Start = DateTime.UtcNow
				},
				Party = new Party()
				{
					Size = 1,
					Max = 10
				}
			});
		}

@M1XT3NZ
Copy link

M1XT3NZ commented Apr 8, 2020

client = new DiscordRpcClient(textBox1.Text);

Why are you doing a textbox?
Multiple users? Different Application id's?
Could you explain that?
also please fix the code tag ;)

@LandDeckTeam
Copy link

LandDeckTeam commented Apr 8, 2020

I'm using textBox becouse I am making a program that let's you easly set your presence (I know that such already exists but it's fun to make one for your own), so user have to set his/her application ID

And I don't know what happend with the code tag :(
If I make any gramatical errors, I'm sorry but I'm polish

EDIT: And my code for party doesn't work either

@M1XT3NZ
Copy link

M1XT3NZ commented Apr 8, 2020

Your code works ;)
you forgot the ID part of the party.
The ID part can be whatever you want it to be.

@LandDeckTeam
Copy link

Ok, I repaired party but really?
When I call Initialize() function (by clicking a button) it still does not update it. Am I really an idiot?

@Lachee Lachee removed the bug Something isn't working label Apr 8, 2020
@Lachee
Copy link
Owner

Lachee commented Apr 8, 2020

Ok, I repaired party but really?
When I call Initialize() function (by clicking a button) it still does not update it. Am I really an idiot?

Please set up the logger to trace and give the supplied logs.

@LandDeckTeam
Copy link

Ok, I repaired party but really?
When I call Initialize() function (by clicking a button) it still does not update it. Am I really an idiot?

Please set up the logger to trace and give the supplied logs.

I can't. When I do this it gives me an error

@Lachee
Copy link
Owner

Lachee commented Apr 8, 2020

"Gives me an error" isn't useful. please provide logs and the actual error its throwing.

Like I mentioned before, I do not help with "it doesnt work" sort of statements because they are uninformative and are annoying to try to deduce how it "doesn't work". If you would like reasonable answers / help from me then I need logs and error messages. Ideally I would have snippets of code that were throwing the errors too (which I assume you already shared :) )

@M1XT3NZ
Copy link

M1XT3NZ commented Apr 8, 2020

What youre doing is,
Creating a new rpcclient
and when you click the button again you want to create another one which doenst work obviously.

To update the text and all call just that

			client.SetPresence(new RichPresence()
			{
				Details = textBox2.Text,
				State = textBox3.Text,
				Assets = new Assets()
				{
					LargeImageKey = "large",
					LargeImageText = "Download from: juzio520.webd.pro/youtubeviewer"
					//SmallImageKey = "image_small"
				},
				Timestamps = new Timestamps()
				{
					Start = DateTime.UtcNow
				},
				Party = new Party()
				{
					Size = 1,
                                        ID = "";
					Max = 10
				}
			});

So you should create just another button or handle it differently

@LandDeckTeam
Copy link

Ok, thanks for all, and sorry

@LandDeckTeam
Copy link

LandDeckTeam commented Apr 8, 2020

Oh and going back to Logger problem: I just didn't added the using DiscordRPC.Logging line on the top
One more time: thanks for help and sorry for the mess :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
Weekend Bug Fix
  
Needs triage
Development

No branches or pull requests

5 participants