Skip to content

Commit

Permalink
Announce
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed Jul 9, 2024
1 parent e14f61b commit cb6d82c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions services/twitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ async function getStream() {
async function getUnbanRequests () {
let result
const options = await _getHeaders()
options.
const channel = await dbManager.getChannel(config.twitch.channels).lean()
const endpoint = `${endpointPrefix}/moderation/unban_requests?broadcaster_id=${channel.roomId}&moderator_id=${config.twitch.userId}&status=pending`

Expand All @@ -52,6 +53,25 @@ async function getUnbanRequests () {
return result
}

async function annunce() {
let result
const options = await _getHeaders()
options.method = 'POST'
const channel = await dbManager.getChannel(config.twitch.channels).lean()
const endpoint = `${endpointPrefix}/chat/announcements?broadcaster_id=${channel.roomId}&moderator_id=${config.twitch.userId}`
try {
const response = await fetch(endpoint, options)
const data = await response.json()
result = data?.data ?? null

} catch {
result = null
}

return result

}

async function getChannel () {
return dbManager.getChannel(config.twitch.channels).lean()
}
Expand Down

0 comments on commit cb6d82c

Please sign in to comment.