Proyecto audio control. inicado con panel y control.

This commit is contained in:
2025-11-11 02:26:04 -05:00
parent 7ea49a026e
commit 6895960127
4248 changed files with 493435 additions and 0 deletions

46
node_modules/telegraf/scenes/base.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
const Composer = require('../composer')
const { compose } = Composer
class BaseScene extends Composer {
constructor (id, options) {
const opts = {
handlers: [],
enterHandlers: [],
leaveHandlers: [],
...options
}
super(...opts.handlers)
this.id = id
this.options = opts
this.enterHandler = compose(opts.enterHandlers)
this.leaveHandler = compose(opts.leaveHandlers)
}
set ttl (value) {
this.options.ttl = value
}
get ttl () {
return this.options.ttl
}
enter (...fns) {
this.enterHandler = compose([this.enterHandler, ...fns])
return this
}
leave (...fns) {
this.leaveHandler = compose([this.leaveHandler, ...fns])
return this
}
enterMiddleware () {
return this.enterHandler
}
leaveMiddleware () {
return this.leaveHandler
}
}
module.exports = BaseScene

79
node_modules/telegraf/scenes/context.js generated vendored Normal file
View File

@@ -0,0 +1,79 @@
const debug = require('debug')('telegraf:scenes:context')
const { safePassThru } = require('../composer')
const noop = () => Promise.resolve()
const now = () => Math.floor(Date.now() / 1000)
class SceneContext {
constructor (ctx, scenes, options) {
this.ctx = ctx
this.scenes = scenes
this.options = options
}
get session () {
const sessionName = this.options.sessionName
let session = this.ctx[sessionName].__scenes || {}
if (session.expires < now()) {
session = {}
}
this.ctx[sessionName].__scenes = session
return session
}
get state () {
this.session.state = this.session.state || {}
return this.session.state
}
set state (value) {
this.session.state = { ...value }
}
get current () {
const sceneId = this.session.current || this.options.default
return (sceneId && this.scenes.has(sceneId)) ? this.scenes.get(sceneId) : null
}
reset () {
const sessionName = this.options.sessionName
delete this.ctx[sessionName].__scenes
}
enter (sceneId, initialState, silent) {
if (!sceneId || !this.scenes.has(sceneId)) {
throw new Error(`Can't find scene: ${sceneId}`)
}
const leave = silent ? noop() : this.leave()
return leave.then(() => {
debug('Enter scene', sceneId, initialState, silent)
this.session.current = sceneId
this.state = initialState
const ttl = this.current.ttl || this.options.ttl
if (ttl) {
this.session.expires = now() + ttl
}
if (silent) {
return Promise.resolve()
}
const handler = typeof this.current.enterMiddleware === 'function'
? this.current.enterMiddleware()
: this.current.middleware()
return handler(this.ctx, noop)
})
}
reenter () {
return this.enter(this.session.current, this.state)
}
leave () {
debug('Leave scene')
const handler = this.current && this.current.leaveMiddleware
? this.current.leaveMiddleware()
: safePassThru()
return handler(this.ctx, noop).then(() => this.reset())
}
}
module.exports = SceneContext

28
node_modules/telegraf/scenes/wizard/context.js generated vendored Normal file
View File

@@ -0,0 +1,28 @@
class WizardContext {
constructor (ctx, steps) {
this.ctx = ctx
this.steps = steps
this.state = ctx.scene.state
this.cursor = ctx.scene.session.cursor || 0
}
get step () {
return this.cursor >= 0 && this.steps[this.cursor]
}
selectStep (index) {
this.cursor = index
this.ctx.scene.session.cursor = index
return this
}
next () {
return this.selectStep(this.cursor + 1)
}
back () {
return this.selectStep(this.cursor - 1)
}
}
module.exports = WizardContext

51
node_modules/telegraf/scenes/wizard/index.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
const Composer = require('../../composer')
const WizardContext = require('./context')
const { compose, unwrap } = Composer
class WizardScene extends Composer {
constructor (id, options, ...steps) {
super()
this.id = id
this.options = typeof options === 'function'
? { steps: [options, ...steps], leaveHandlers: [] }
: { steps: steps, leaveHandlers: [], ...options }
this.leaveHandler = compose(this.options.leaveHandlers)
}
set ttl (value) {
this.options.ttl = value
}
get ttl () {
return this.options.ttl
}
leave (...fns) {
this.leaveHandler = compose([this.leaveHandler, ...fns])
return this
}
leaveMiddleware () {
return this.leaveHandler
}
middleware () {
return compose([
(ctx, next) => {
const wizard = new WizardContext(ctx, this.options.steps)
ctx.wizard = wizard
return next()
},
super.middleware(),
(ctx, next) => {
if (!ctx.wizard.step) {
ctx.wizard.selectStep(0)
return ctx.scene.leave()
}
return unwrap(ctx.wizard.step)(ctx, next)
}
])
}
}
module.exports = WizardScene