28 lines
1.3 KiB
TypeScript
28 lines
1.3 KiB
TypeScript
import * as bp from '.botpress'
|
|
|
|
const plugin = new bp.Plugin({
|
|
actions: {},
|
|
})
|
|
|
|
const log = (...x: any[]): undefined => {
|
|
console.info(...x)
|
|
return
|
|
}
|
|
|
|
plugin.on.beforeIncomingEvent('*', async (x) => log('before_incoming_event', { data: x.data }))
|
|
plugin.on.beforeIncomingMessage('*', async (x) =>
|
|
log('before_incoming_message', { data: x.data, user: x.user?.id, conversation: x.conversation?.id })
|
|
)
|
|
plugin.on.beforeOutgoingMessage('*', async (x) => log('before_outgoing_message', { data: x.data }))
|
|
plugin.on.beforeOutgoingCallAction('*', async (x) => log('before_call_action', { data: x.data }))
|
|
plugin.on.afterIncomingEvent('*', async (x) => log('after_incoming_event', { data: x.data }))
|
|
plugin.on.afterIncomingMessage('*', async (x) =>
|
|
log('after_incoming_message', { data: x.data, user: x.user?.id, conversation: x.conversation?.id })
|
|
)
|
|
plugin.on.afterOutgoingMessage('*', async (x) => log('after_outgoing_message', { data: x.data }))
|
|
plugin.on.afterOutgoingCallAction('*', async (x) => log('after_call_action', { data: x.data }))
|
|
plugin.on.beforeIncomingCallAction('*', async (x) => log('before_incoming_call_action', { data: x.data }))
|
|
plugin.on.afterIncomingCallAction('*', async (x) => log('after_incoming_call_action', { data: x.data }))
|
|
|
|
export default plugin
|