[Issue/Bug]: Avoiding "Discord Activity couldn't be updated" warning message #71

Closed
opened 2024-10-04 09:14:05 +00:00 by Yolwoocle · 6 comments
Yolwoocle commented 2024-10-04 09:14:05 +00:00 (Migrated from github.com)

What happened?

I call DiscordRPC.refresh every 3 seconds or so, but if Discord is not launched, I get the following warning message every time the function is called:

Discord Activity couldn't be updated. It could be that Discord isn't running!

Now, this is fine, but is there any way to avoid having this warning message in the console, perhaps by detecting if Discord is launched/can be updated, and only calling refresh when needed.

Version

1.3.1

Godot Version

4.3.stable.official

Exact steps to reproduce this error

Example reproduction code, should be ran while Discord isn't launched:

GDScript

var _discord_rpc_update_timer = 0.0

func _ready():
    DiscordRPC.app_id = DISCORD_RPC_APP_ID

func _process(delta):
    _discord_rpc_update_timer -= delta
    if _discord_rpc_update_timer < 0:
        DiscordRPC.details = "Playing my incredible game"
        DiscordRPC.refresh()
        _discord_rpc_update_timer = 3.0

Godot output

No response

Additional information

No response

Checks

### What happened? I call `DiscordRPC.refresh` every 3 seconds or so, but if Discord is not launched, I get the following warning message every time the function is called: ``` Discord Activity couldn't be updated. It could be that Discord isn't running! ``` Now, this is fine, but is there any way to avoid having this warning message in the console, perhaps by detecting if Discord is launched/can be updated, and only calling `refresh` when needed. ### Version 1.3.1 ### Godot Version 4.3.stable.official ### Exact steps to reproduce this error Example reproduction code, should be ran while Discord isn't launched: ### GDScript ```gdscript var _discord_rpc_update_timer = 0.0 func _ready(): DiscordRPC.app_id = DISCORD_RPC_APP_ID func _process(delta): _discord_rpc_update_timer -= delta if _discord_rpc_update_timer < 0: DiscordRPC.details = "Playing my incredible game" DiscordRPC.refresh() _discord_rpc_update_timer = 3.0 ``` ### Godot output _No response_ ### Additional information _No response_ ### Checks - [X] I tried reinstalling the addon or tried to fix it myself with other methods. - [X] I tried restarting Discord and Godot completely. - [X] I did read the documentation https://vaporvee.com/docs/discord-rpc-godot/
Yolwoocle commented 2024-10-04 09:14:50 +00:00 (Migrated from github.com)

This isn't a bug, more like an issue or suggestion.

This isn't a bug, more like an issue or suggestion.

Nope you are using it extremely wrong. You shouldn't refresh every 3 seconds first of all and also there is DiscordRPC.get_is_discord_working(). Refreshing it every 3 seconds overloads the rpc server and wouldn't work. Also why are you updating the same Activity all the time? Does it dissapear for some reason?

Nope you are using it extremely wrong. You shouldn't refresh every 3 seconds first of all and also there is `DiscordRPC.get_is_discord_working()`. Refreshing it every 3 seconds overloads the rpc server and wouldn't work. Also why are you updating the same Activity all the time? Does it dissapear for some reason?
Yolwoocle commented 2024-10-04 23:04:19 +00:00 (Migrated from github.com)

Nope you are using it extremely wrong. You shouldn't refresh every 3 seconds

Okay, I come from a different DiscordRPC lib from a different language and this is how I did it there, I didn't expect it to be different here. What would be the correct way to do it?

Refreshing it every 3 seconds overloads the rpc server and wouldn't work. Also why are you updating the same Activity all the time? Also why are you updating the same Activity all the time? Does it dissapear for some reason?

I'm updating things like the current level the player is in, whether the player is in a menu, which can change rapidly. Should I only update and refresh when there is an actual change? It seems to work though. Why would this overload the RPC servers?

there is DiscordRPC.get_is_discord_working()

This is mentioned nowhere in the docs. I'd highly appreciate if there was a page in the docs with a complete reference of all the API's functions, it would be of great help. 😄

> Nope you are using it extremely wrong. You shouldn't refresh every 3 seconds Okay, I come from a different DiscordRPC lib from a different language and this is how I did it there, I didn't expect it to be different here. What would be the correct way to do it? > Refreshing it every 3 seconds overloads the rpc server and wouldn't work. Also why are you updating the same Activity all the time? Also why are you updating the same Activity all the time? Does it dissapear for some reason? I'm updating things like the current level the player is in, whether the player is in a menu, which can change rapidly. Should I only update and refresh when there is an actual change? It seems to work though. Why would this overload the RPC servers? > there is `DiscordRPC.get_is_discord_working()` This is mentioned nowhere in the docs. I'd highly appreciate if there was a page in the docs with a complete reference of all the API's functions, it would be of great help. 😄

DiscordRPC.get_is_discord_working() is the only function missing in the docs will add that though. There is a run_callbacks in a autoload automatically installed which must be the thing you where seeing in other libs. Only update those things in signals if you can. The thing is the RPC server from Discord is really buggy. Its not reliable at all and a complete mess. When you rapidly change the activity and it still shows up or not doesn't mean it shows for other users so just do it the right way initially.

`DiscordRPC.get_is_discord_working()` is the only function missing in the docs will add that though. There is a `run_callbacks` in a autoload automatically installed which must be the thing you where seeing in other libs. Only update those things in signals if you can. The thing is the RPC server from Discord is really buggy. Its not reliable at all and a complete mess. When you rapidly change the activity and it still shows up or not doesn't mean it shows for other users so just do it the right way initially.
Yolwoocle commented 2024-10-05 11:16:49 +00:00 (Migrated from github.com)

Okay, I see. I'll change my code so that it only calls refresh in reaction to signals, thanks a lot for your help 👍

Okay, I see. I'll change my code so that it only calls refresh in reaction to signals, thanks a lot for your help 👍

No problem :)

No problem :)
Sign in to join this conversation.
No description provided.