chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:34:48 +08:00
commit 77bb5bf71f
3762 changed files with 353249 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
.botpress
+30
View File
@@ -0,0 +1,30 @@
import * as sdk from '@botpress/sdk'
import * as env from './.genenv'
import chat from './bp_modules/chat'
import telegram from './bp_modules/telegram'
export default new sdk.BotDefinition({
actions: {
sayHello: {
title: 'Say Hello',
description: 'Says hello to the caller',
input: {
schema: sdk.z.object({ name: sdk.z.string().optional() }),
},
output: {
schema: sdk.z.object({ message: sdk.z.string() }),
},
},
},
})
.addIntegration(telegram, {
enabled: true,
configuration: {
botToken: env.HELLO_WORLD_TELEGRAM_BOT_TOKEN,
typingIndicatorEmoji: true,
},
})
.addIntegration(chat, {
enabled: true,
configuration: {},
})
+13
View File
@@ -0,0 +1,13 @@
import rootConfig from '../../eslint.config.mjs'
export default [
...rootConfig,
{
languageOptions: {
parserOptions: {
project: ['./tsconfig.json'],
tsconfigRootDir: import.meta.dirname,
},
},
},
]
+29
View File
@@ -0,0 +1,29 @@
{
"name": "@bp-bots/hello-world",
"description": "Hello-world bot",
"private": true,
"scripts": {
"postinstall": "genenv -o ./.genenv/index.ts -e HELLO_WORLD_TELEGRAM_BOT_TOKEN",
"check:type": "tsc --noEmit",
"check:bplint": "bp lint",
"build": "bp add -y && bp build"
},
"dependencies": {
"@botpress/cli": "workspace:*",
"@botpress/client": "workspace:*",
"@botpress/sdk": "workspace:*"
},
"devDependencies": {
"@botpress/cli": "workspace:*",
"@botpress/common": "workspace:*",
"@botpress/sdk": "workspace:*",
"@botpresshub/chat": "workspace:*",
"@botpresshub/telegram": "workspace:*",
"@bpinternal/genenv": "0.0.1",
"@types/json-schema": "^7.0.12"
},
"bpDependencies": {
"telegram": "../../integrations/telegram",
"chat": "../../integrations/chat"
}
}
+26
View File
@@ -0,0 +1,26 @@
# Hello World
## Description
This is a simple hello-world bot that always reply with text "Hello World!".
## Usage
1. Create a new bot using the Botpress Dashboard or the Botpress CLI.
2. Build the bot using command `bp build`
3. Deploy the bot using command `bp deploy`
## Running locally
There are few different ways of running your bot locally:
```sh
# 1. To run the bundle created by the build command:
bp serve --port 9999
# 2. To run with ts-node:
start_script="import bot from './src'; void bot.start()"
ts-node -T -r @botpress/cli/init -e $start_script
```
+30
View File
@@ -0,0 +1,30 @@
import * as bp from '.botpress'
const bot = new bp.Bot({
register: async (props) => {
props.logger.info('Registering Hello World bot!')
},
actions: {
sayHello: async ({ input }) => {
const name = input?.name || 'World'
return { message: `Hello, ${name}!` }
},
},
})
bot.on.message('*', async (props) => {
const { message, client, ctx } = props
const { message: response } = await bot.actionHandlers.sayHello({ ...props, input: {} })
await client.createMessage({
conversationId: message.conversationId,
userId: ctx.botId,
tags: {},
type: 'text',
payload: {
text: response,
},
})
})
export default bot
+8
View File
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"paths": { "*": ["./*"] },
"outDir": "dist"
},
"include": [".botpress/**/*", "src/**/*", "*.ts"]
}