Skip to content
YYBartT edited this page Aug 15, 2024 · 9 revisions

Core

Discord SDK: Discord

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.

Constants

This module includes a set of predefined constants that can be utilized for various purposes. Browse through the available constants to find values relevant to your needs and enhance the efficiency of your code.



Back To Top

Discord_Core_Create

Discord Function: Create

This function initialises the Discord extension and returns whether this was successful. The creationFlag parameter determines if the Discord extension requires or doesn't require Discord to be running. If the optional creationFlag is set to Discord_CreateFlags_Default (the default value) and Discord is not running, it will:

  1. Close your game
  2. Open Discord
  3. Attempt to re-open your game

Syntax:

Discord_Core_Create(appId, creationFlag=Discord_CreateFlags_Default)
Argument Type Description
appId Int64 Application identifier
creationFlag Discord_CreateFlags Discord_CreateFlags_Default or Discord_CreateFlags_NoRequireDiscord



Returns:

Boolean


Example:

if(!Discord_Core_Create(_applicationId, Discord_CreateFlags_Default))
{
    show_message_async("Discord Initialisation Error");
    exit;
}



Back To Top

Discord_Core_RunCallbacks

Discord Function: RunCallbacks

This function requests the extension instances to do work.

Warning

It is imperative that this function is called at regular intervals to ensure that all the services offered by the SDK function optimally.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

Discord_Core_RunCallbacks()



Returns:

N/A


Triggers:

Social Async Event

This async event is triggered whenever the user struct of the currently connected user changes. They may have changed their avatar, username, or something else.

Key Type Description
result Real Result code of the async request
type String The string "Discord_Users_OnCurrentUserUpdate"

Example:

/// Step Event
Discord_Core_RunCallbacks();



Back To Top

Discord_Result

Discord Enum: Result Enum


Member Description
Discord_OK 0 A constant that indicates that the result is OK


Back To Top

Discord_CreateFlags

Discord Enum: CreateFlags Enum

These constants are referenced by the following functions:


Member Description
Discord_CreateFlags_Default 0 Requires Discord to be running to play the game
Discord_CreateFlags_NoRequireDiscord 1 Does not require Discord to be running, use this on other platforms

Clone this wiki locally