Skip to content
ForgeCastDocs

YouTube

Chat as the channel, run polls, moderate the live chat, change the stream's title and read how the stream is doing.

Functions

youtube.send_chat(text, callback)

Write in the live chat as the channel (1 to 200 characters).

  • text: string
  • callback: fun(message: { id: string }?, error?: string), optional

Returns integer id

chats.on(Event.NewChat, function(m)
  if m.text == "!discord" then youtube.send_chat("Join us: discord.gg/example") end
end)

youtube.poll(question, options, callback)

Start a poll in the live chat: a question (up to 100 characters) and 2 to 4 answers (35 each).

Name

Type

Returns integer id

youtube.end_poll(id, callback)

End the open poll (or the one with that id) and get its votes.

  • id: string|fun(result: YoutubePollResult?, error?: string), optional
  • callback: fun(result: YoutubePollResult?, error?: string), optional

Returns integer id

youtube.delete_message(message, callback)

Take a message out of the live chat. Give the chat message itself: the app finds it in YouTube's list by who wrote what.

  • message: ChatMessage|string
  • callback: fun(ok: boolean?, error?: string), optional

Returns integer id

youtube.timeout(who, seconds, callback)

Keep a viewer out of the live chat for 10 seconds to a day. Give a chat message, its author or a channel id ("UC…").

Name

Type

Returns integer id

youtube.timeout(m, 300, function(ban) if ban then print("timed out until it runs out") end end)

youtube.ban(who, callback)

Ban a viewer from the live chat for good.

  • who: ChatMessage|table|string
  • callback: fun(ban: YoutubeBan?, error?: string), optional

Returns integer id

youtube.unban(ban, callback)

Lift a ban, or end a timeout early: give what youtube.ban or youtube.timeout answered. Needs "youtube.moderate".

  • ban: YoutubeBan|string
  • callback: fun(ok: boolean?, error?: string), optional

Returns integer id

youtube.set_title(title, callback)

Change the live stream's title (up to 100 characters, no < or >); before you go live, the next scheduled stream's.

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

Returns integer id

youtube.set_description(text, callback)

Change the live stream's description (up to 5000 characters, no < or >); before you go live, the next scheduled stream's.

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

Returns integer id

youtube.health(callback)

How YouTube says the stream is arriving: the encoder's connection, resolution and any issues (the stream key is never shown). The answer is reused for 15 seconds.

  • callback: fun(streams: YoutubeStreamHealth[]?, error?: string)

Returns integer id

youtube.stream_stats(video, callback)

A video's numbers from YouTube: views, likes, comments and, while live, concurrent viewers. The live stream by default.

  • video: string|fun(stats: YoutubeStats?, error?: string), optional. an 11-character video id
  • callback: fun(stats: YoutubeStats?, error?: string), optional

Returns integer id

youtube.quota(callback)

How much of the channel's daily YouTube allowance is used.

  • callback: fun(quota: YoutubeQuota?, error?: string)

Returns integer id

youtube.upcoming()

The channel's scheduled streams (the same as channel.upcoming).

Returns table[]

Types

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

On this page