First impl of the streamer.bot api changes

This commit is contained in:
2024-01-26 12:46:46 -05:00
parent 79dccc9709
commit 9fafe2b318
8 changed files with 235 additions and 45 deletions

View File

@@ -1,19 +1,87 @@
module.exports = function (self) {
export default function (self) {
self.setActionDefinitions({
sample_action: {
name: 'My First Action',
runAction: {
name: 'Run Action',
options: [
{
id: 'num',
type: 'number',
label: 'Test',
default: 5,
min: 0,
max: 100,
id: 'action',
type: 'dropdown',
label: 'Action',
default: '',
choices: self.actions.actions.map((value) => ({ label: value.name, ...value })),
},
],
callback: async (event) => {
console.log('Hello world!', event.options.num)
console.log('Run Action!', event.options.action)
await self.client.doAction(event.options.action)
},
},
runActionAdvanced: {
name: 'Run Action Advanced',
options: [
{
id: 'action',
type: 'dropdown',
label: 'Action',
default: '',
choices: self.actions.actions.map((value) => ({ label: value.name, ...value })),
},
{
id: 'actionArgs',
type: 'textinput',
label: 'Action Arguments',
default: 0,
},
],
callback: async (event) => {
console.log('Run Action Advanced!', event.options.action)
await self.client.doAction(event.options.action, event.options.actionArgs)
},
},
runActionByName: {
name: 'Run Action by Name',
options: [
{
id: 'actionName',
type: 'textinput',
label: 'Action Name',
default: '',
},
],
callback: async (event) => {
console.log('Run Action by Name: ', event.options.actionName)
await self.client.doAction(event.options.actionName)
},
},
runActionById: {
name: 'Run Action by Id',
options: [
{
id: 'actionId',
type: 'textinput',
label: 'Action Id',
default: 0,
},
],
callback: async (event) => {
console.log('Run Action by Id: ', event.options.actionId)
await self.client.doAction(event.options.actionId)
},
},
clearCredits: {
name: 'Clear Credits',
options: [],
callback: async (event) => {
console.log('Clear Credits!')
await self.client.clearCredits()
},
},
testCredits: {
name: 'Test Credits',
options: [],
callback: async (event) => {
console.log('Test Credits!')
await self.client.testCredits()
},
},
})