Urban Bot Starter
October 6, 2021 ยท View on GitHub

Urban Bot Starter
Develop chatbots with zero configuration using typescript. If you want to use javascript use js starter.
Launch
npx create-urban-bot my-app
Telegram
- Get telegram token
- Paste token to
.envTELEGRAM_TOKEN=YOUR_TOKEN - Uncomment
// import './render/telegram';insidesrc/index.ts - Run
npm run devand check your bot
Discord
- Get discord token
- Paste token to
.envDISCORD_TOKEN=YOUR_TOKEN - Uncomment
// import './render/discord';insidesrc/index.ts - Run
npm run devand check your bot
Slack
- Create slack app
- Paste token to
.envSLACK_TOKEN=YOUR_TOKEN - Paste signing secret to
.envSLACK_SIGNING_SECRET=YOUR_SIGNING_SECRET - Run
npm run start-tunneland connect the public url with slack webhook. - Uncomment
// import './render/slack';insidesrc/index.ts - Run
npm run devand check your bot
- Create facebook app
- Paste credentials to
.env - Run
npm run start-tunneland connect the public url with facebook webhook. - Uncomment
// import './render/facebook';insidesrc/index.ts - Run
npm run devand check your bot
Scripts
npm run build
Build your code to dist folder.
npm run dev
Build and start your code after every code changes. Settings are inside package.json nodemonConfig.
npm run lint
Check code style. All rules are inside .eslintrc.js.
npm run lint:fix
Fix code style issues automatically including prettier formatting.
npm run start
Start code from dist folder.
npm run start-tunnel
Start a public URL for exposing your local server.
npm run test
Start your tests. File matching *.test.(js|jsx).
npm run typecheck
Check typescript errors.
Import files
You could import any file and paste to components as buffer or stream. It will be automatically added to dist bundle.
import image from './assets/logo.png';
import doc from './assets/document.doc';
function App() {
return (
<>
<Image file={image} />
<File file={fs.readFileSync(doc)} />
</>
);
}