Skip to content
This repository was archived by the owner on May 31, 2024. It is now read-only.

Installation

LennyPhoenix edited this page Dec 30, 2021 · 9 revisions
  • Download the discord_sdk folder from the demo project, and place it anywhere in your project.

  • Compile or download (available as a release or artefacts) the Godot Discord SDK shared libraries, and the Discord Game SDK shared libraries (lib/ of Discord Game SDK (2.5.6)). The corresponding shared libraries should be located in the same folder. For example: place the discord_game_sdk.dll file in the same folder as the gdsdk.dll.

    File layout example

    You may also run the setup script (setup.bat or setup.sh) instead if applicable.

  • Change the paths of the .gdnlib file to match the shared libraries you downloaded earlier.

  • You can now access the classes from the Discord class in GDScript via preloaded constants.

  • For an example of the usage, view the demo project.

Quickstart

extends Node

var core: Discord.Core

func enum_to_string(the_enum: Dictionary, value: int) -> String:
	var index: = the_enum.values().find(value)
	var string: String = the_enum.keys()[index]
	return string

func _ready() -> void:
	core = Discord.Core.new()
	var result: int = core.create(
		793449535632441374,
		Discord.CreateFlags.DEFAULT
	)
	print("Created Discord Core: ", enum_to_string(Discord.Result, result))
	if result != Discord.Result.OK:
		core = null

func _process(_delta: float) -> void:
	if core:
		var result: int = core.run_callbacks()
		if result != Discord.Result.OK:
			print("Callbacks failed: ", enum_to_string(Discord.Result, result))
Clone this wiki locally