telegraf / micro-bot

:robot: Zero-configuration Telegram bot runner
MIT License
182 stars 29 forks source link

Couldn't run on Now. No error and No result #22

Open mortezae opened 5 years ago

mortezae commented 5 years ago

Hello. I'm struggling with a micro-bot setup on Zeit Now and tried many different configs but get no result. I'm newbie on both Now and Telegraf, BTW I can run a simple echo web server on the same Now project but no success with bot code. It doesn't give any error when deploying and bot doesn't work at all. I don't know where I went wrong This is all the code and files:

index.js: I used different codes such as this simple lines

const { mount, reply } = require('micro-bot')
module.exports = mount('sticker', reply('👍'))

packages.json

{
  "name": "mybot",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "micro-bot -t ${BOT_TOKEN} -d ${NOW_URL} index.js"
  },
  "dependencies": {
    "micro-bot": "^2.5.3"
  }
}

now.json

{
    "version": 2,
    "name": "mybot",
    "builds": [
        { "src": "*.js", "use": "@now/node" }
    ],
}

And my deploy command:

now -e BOT_TOKEN='828040278:AAG-NPbrdM5LkIUA1V5tbNxpA-yxemh5Cdc'

I don't know if the bot automatically sets Webhook, so I did it manually. https://api.telegram.org/botMYTOKEN/setWebhook?url=https://projecturl.me.now.sh

franspeter commented 5 years ago

Any update here?

weiran commented 5 years ago

micro-bot doesn't support now version 2, you have to use v1 until: #17 is resolved.