Skip to content
ForgeCastDocs

Speech, clipboard and the app

Speak out loud, copy text, add a page, Ctrl+K commands, chat menu items, name badges, charts, tabs and pickers.

Functions

tts.say(text, opts, callback)

Say text out loud with the PC's voices (viewers hear it when OBS captures desktop audio). callback(true) when it has been said.

Name

Type

tts.stop()

Stop speaking (and forget what was waiting).

tts.voices(callback)

The voices this PC has: { { name, lang, default } }.

  • callback: fun(voices: { name: string, lang: string, default: boolean }[]?)

clipboard.copy(text, callback)

Put text on the clipboard (a plugin can't read what is there).

  • text: string
  • callback: fun(ok: boolean?, error?: string), optional

Page:render(tree)

Show a new interface on the page (a page without tabs).

Page:render_tab(tab, tree)

Show a new interface in one of the page's tabs.

  • tab: string. the tab's id
  • tree: UiNode

Page:remove()

Take the page out of the sidebar.

A page of the plugin's own in the sidebar, under a heading with the plugin's name (never mixed with ForgeCast's own links). Up to 8 pages; each may have tabs. Calling it again with the same id changes it.

Returns Page

local stats = nav.page{ id = "stats", title = "Stats", icon = "chart", tabs = {
  { id = "today", title = "Today", content = ui.text("Loading…") },
  { id = "chatters", title = "Chatters", icon = "users" },
} }
stats:render_tab("today", ui.grid{ columns = 3, ui.stat("Messages", 120), ui.stat("Chatters", 31), ui.stat("Tips", "$12") })

Take a page out of the sidebar.

  • id: string

ui.page(spec)

The same as nav.page.

Returns Page

ui.remove_page(id)

Take a page away (Page:remove does the same).

  • id: string

ui.command(spec)

A command in the Ctrl+K command palette: { id, name, description, run }.

  • spec: { id: string, name: string, description: string?, run: fun() }

Returns string id

ui.remove_command(id)

Take a command out of Ctrl+K.

  • id: string

ui.context_menu(spec)

An item in ForgeCast's own right-click menu ("Translate this", "Add to my notes"). where says when it shows: "page" (anywhere, the default), "selection" (on selected text), "link" (on a link), "chat" (on a chat message), or a list of them. on_click(ctx) gets what was right-clicked. icon is one of ui.icon's names. Up to 10 per plugin.

  • spec: { id: string, label: string, icon: string?, where: string|string[]|nil, on_click: fun(ctx: ContextMenuClick) }

Returns string id

ui.remove_context_menu(id)

Take an item out of the right-click menu.

  • id: string

chats.menu(spec)

An item in the menu of a chat message in ForgeCast ("Add to queue", "Give 100 points"): on_click(chat) gets the message.

  • spec: { id: string, label: string, on_click: fun(chat: Chat) }

Returns string id

chats.remove_menu(id)

Take a chat menu item away.

  • id: string

chats.decorate(user, spec)

A small badge (up to 12 characters) or a colour next to a viewer's name in ForgeCast's chat ("VIP", "1,240 pts", "first time").

  • user: ChatAuthor|string
  • spec: { badge: string?, color: string?, title: string? }

chats.undecorate(user)

Take a viewer's badge away.

  • user: ChatAuthor|string

Returns boolean found

ui.chart(props)

A chart: { kind = "line" | "bar" | "area" | "pie" | "donut", labels = { … }, series = { { name, values = { … }, color } }, height }.

  • props: table

Returns UiNode

ui.tabs(props)

Tabs: ui.tabs{ value = "a", on_change = fn, ui.tab{ id = "a", label = "A", … }, ui.tab{ … } }.

  • props: table

Returns UiNode

ui.tab(props)

One tab of ui.tabs: { id, label, …children }.

  • props: table

Returns UiNode

ui.sortable(props)

A list the streamer can reorder by dragging: { name, items = { { id, label } }, on_change }. ev.value is the ids in their new order.

  • props: table

Returns UiNode

ui.color(props)

A colour picker: { name, label, value = "#ff0044" }.

Returns UiNode

ui.date(props)

A date (and time) picker: { name, label, value = ms, time = true }; ev.value is ms since 1970.

  • props: table

Returns UiNode

Types

Open a type to see its fields; type names above link here.

On this page