Skip to content

host

Services PhoenixCord provides to every plugin.

log(level: log-level, message: string)

Write to the PhoenixCord log, attributed to this plugin.

get-setting(key: string) → option<setting-value>

The current value of a setting, or its default. none for unknown keys that were never set.

set-setting(key: string, value: setting-value)

Store a setting and deliver event.setting-changed after the current call returns.

storage-get(key: string) → option<string>

Read from this plugin’s persistent key-value storage.

storage-set(key: string, value: string)

storage-delete(key: string)

storage-keys() → list<string>

set-timeout(delay-ms: u64) → u64

Deliver event.timer with the returned ID once, after delay-ms milliseconds.

set-interval(interval-ms: u64) → u64

Deliver event.timer with the returned ID every interval-ms milliseconds.

clear-timer(id: u64)

Cancel a timeout or interval.

fetch(request: http-request) → u64

Send an HTTP request in the background. The result arrives as event.http with the returned ID.

show-toast(message: string, kind: toast-kind)

show-notice(notice: notice)

notify(notification: notification)

open-modal(content: element) → u64

Open a modal showing content. Returns its ID.

update-modal(id: u64, content: element)

close-modal(id: u64)

request-render()

Ask the client to call this plugin’s render hooks again, e.g. after its state changed.

clipboard-write(text: string)

clipboard-read() → option<string>

open-url(url: string)

Open a URL in the user’s browser.

is-plugin-enabled(name: string) → bool

Whether a plugin with this name is loaded and running.