discord-rpc-csharp icon indicating copy to clipboard operation
discord-rpc-csharp copied to clipboard

Timestamps. End.

Open Vusal-Shabiev opened this issue 11 months ago • 2 comments

Hello everyone, I can’t figure it out with TimeStamps. I tried TimeStamp.FromSecond(100), for example. Everything worked. When I send real time it doesn't work? The textbox shows this real time, what's wrong in my code?

try {
    //Set the rich presence
    //Call this as many times as you want and anywhere in your code.
    client.SetPresence(new RichPresence()
    {
        Details =  audio.Artist,
        State = audio.Title,
        Assets = new Assets()
        {
            LargeImageKey = "vk_logo",
            LargeImageText = "Cлушает в VK Player",
            SmallImageKey = ""
        },

        Timestamps = new Timestamps()
        {
            Start = DateTime.UtcNow,
            End = DateTime.UtcNow + TimeSpan.FromSeconds(endtime),
        },
    }) ; 
}
catch
{

}

private void SetEndTime(object Object, EventArgs e)
{
    int Seconds = (int)Player.NaturalDuration.TimeSpan.TotalSeconds;
    DurationSlider.Maximum = Seconds;
    int Minutes = Seconds / 60;
    int MinutedDS = Seconds;
    Seconds -= Minutes * 60;
    string strSeconds = $"{Seconds}";
    if (Seconds < 10)
    {
        strSeconds = $"0{Seconds}";
    }
    string EndTime = $"{Minutes}:{strSeconds}";
    TimeEndInfoLabel.Text = EndTime;
    endtime = MinutedDS + Seconds;
}

public double endtime;

Vusal-Shabiev avatar Mar 18 '24 21:03 Vusal-Shabiev

make sure you call client.SetPresence in your SetEndTime function, so it updates discord when endtime changes.

Lachee avatar Mar 18 '24 22:03 Lachee

make sure you call client.SetPresence in your SetEndTime function, so it updates discord when endtime changes.

Thank you!

Vusal-Shabiev avatar Mar 19 '24 06:03 Vusal-Shabiev