Skip to main content

Getting started

๐Ÿ“ฆ Installationโ€‹

Install the @opencord/client package in your project:

## npm
npm install @opencord/client

## yarn
yarn add @opencord/client

โš™๏ธ Initializationโ€‹

Import and initialize the Opencord client in your project.

import { getClient } from "@opencord/client";

const oc = getClient();

// Check if the platform is not unknown, indicating that the plugin is currently
// running in the Opencord runtime and has initialized successfully.
if (oc.platform !== "unknown") {
console.log("โœ… Opencord client initialized.");
} else {
console.log("โŒ Opencord client initialization failed.");
}

๐Ÿ’ก Usageโ€‹

The OpencordClient provides a set of methods for accessing the SDK's features.

For example, you can use the getCode() method to retrieve the authorization code.

const { code, message, data } = await oc.getCode();

if (code === 200) {
console.log("โœ… Get authorization code successed", data);
} else {
console.log("โŒ Get authorization code failed.", code, message);
}

๐Ÿš€ Next Stepsโ€‹

Once you have successfully integrated the Opencord SDK into your project, it is recommended that you explore the Client Methods documentation to fully discover the capabilities of the SDK.

You can also visit Create your plugin to learn more about creating, developing, testing, and publishing your first Opencord plugin.

Furthermore, welcome to join our Opencord server to obtain additional technical support, and to preview the plugin's capabilities firsthand in the # ๐ŸŽฎ๏ฝœPlayground channel.