Lachee / discord-rpc-csharp

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

how to update RPC without reseting timestamp #188

Closed sepi1385 closed 2 years ago

sepi1385 commented 2 years ago

this is my code and every time you click on a button, the time resets to 00:00. any idea?

        private void button1_Click(object sender, EventArgs e)
        {
            if (initialized == false)
            {
                MessageBox.Show("You need to initialize app first!");
            }
            else
            {
                var presence = new DiscordRPC.RichPresence()
                {
                    Details = $"{textBox2.Text}",
                    State = $"{textBox1.Text}",
                    Timestamps = Timestamps.Now,
                    Buttons = new Button[]
                        {
                            new Button() { Label = $"{textBox8.Text}", Url = $"{textBox9.Text}" },
                            new Button() { Label = $"{textBox11.Text}", Url = $"{textBox10.Text}" }
                        },
                    Assets = new Assets()
                    {
                        LargeImageKey = $"{textBox5.Text}",
                        LargeImageText = $"{textBox7.Text}",
                        SmallImageKey = $"{textBox4.Text}",
                        SmallImageText = $"{textBox6.Text}",
                    }
                };

            }
        }
Lachee commented 2 years ago

Stop using Timestamps.now or alternatively, stop creating a new presence object every time