example.gd 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. class_name DiscordRPCTutorial
  2. extends Node
  3. ## 1. Put the addons/ folder in your Godot project[br]
  4. ## 2. Enable the addon in your Project Settings under "Plugins" and "DiscordRPC". [br](if it doesn't show up restart your project and try again)[br]
  5. ## 3. Restart your project[br]
  6. ## 4. Create an Application under https://discord.com/developers/applications and get the Application ID br]
  7. ## 5. (optional) Set images under "Rich Presence" and "Art Assets" and remember the keys[br]
  8. ##
  9. ## This is your [code]_ready()[/code] function wich could be anywhere
  10. ## [codeblock]
  11. ## func _ready():
  12. ## # Application ID
  13. ## DiscordRPC.app_id = 1099618430065324082
  14. ## # this is boolean if everything worked
  15. ## print("Discord working: " + str(DiscordRPC.get_is_discord_working()))
  16. ## # Set the first custom text row of the activity here
  17. ## DiscordRPC.details = "A demo activity by vaporvee#1231"
  18. ## # Set the second custom text row of the activity here
  19. ## DiscordRPC.state = "Checkpoint 23/23"
  20. ## # Image key for small image from "Art Assets" from the Discord Developer website
  21. ## DiscordRPC.large_image = "game"
  22. ## # Tooltip text for the large image
  23. ## DiscordRPC.large_image_text = "Try it now!"
  24. ## # Image key for large image from "Art Assets" from the Discord Developer website
  25. ## DiscordRPC.small_image = "boss"
  26. ## # Tooltip text for the small image
  27. ## DiscordRPC.small_image_text = "Fighting the end boss! D:"
  28. ## # "02:41 elapsed" timestamp for the activity
  29. ## DiscordRPC.start_timestamp = int(Time.get_unix_time_from_system())
  30. ## # "59:59 remaining" timestamp for the activity
  31. ## DiscordRPC.end_timestamp = int(Time.get_unix_time_from_system()) + 3600
  32. ## # Always refresh after changing the values!
  33. ## DiscordRPC.refresh()
  34. ## [/codeblock]
  35. ##
  36. ## @tutorial(More information here): https://github.com/vaporvee/discord-rpc-godot/wiki/Quick-start
  37. ## @tutorial(Make your Application ID and else here): https://discord.com/developers/applications