【问题标题】:Heroku telegam python bot deployHeroku 电报 python 机器人部署
【发布时间】:2018-09-05 22:10:05
【问题描述】:

我的python电报机器人代码是

import telebot, os
from telebot import types
# from telebot import
from settings import TOKEN
import requests
#from pyTelegramBotAPI import users
from pyzbar.pyzbar import decode
from PIL import Image
import sqlite3
import json

bot = telebot.TeleBot(TOKEN)

@bot.message_handler(commands=['start'])
def send_welcome(message):
    markup = types.ReplyKeyboardMarkup()
    markup.add(types.KeyboardButton(text="Дати доступ до гуолокації.", request_location=True))
    bot.send_message(message.chat.id, "Нам потрібена ваша геолокація", reply_markup=markup)

bot.polling()

Proc 文件是web: python bot.py

当我在本地运行它时 bot 正在工作,部署后 bot 不会向用户发送任何内容

【问题讨论】:

    标签: python heroku telegram


    【解决方案1】:

    你必须上传 3 个文件到 Heroku:

    过程

    web: python bot.py
    

    requirements.txt

    pyTelegramBotAPI==3.6.6
    heroku==0.1.4
    

    + 其他模块

    runtime.txt

    python-3.7.0
    

    或其他python版本

    我建议将bot.polling() 替换为bot.infinity_polling(True)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-08
      • 1970-01-01
      • 1970-01-01
      • 2020-10-28
      相关资源
      最近更新 更多