бот запущен один раз только в этом коде, токен менял несколько раз
вот код:
from flask import Flask, render_template, request, redirect, url_for, flash, make_response, current_app
from flask_socketio import SocketIO
from flask_sqlalchemy import SQLAlchemy
import telebot
from threading import Thread
from app import *
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret!'
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///Coin.db"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
socketio = SocketIO(app)
db = SQLAlchemy(app)
bot_token = token
bot = telebot.TeleBot(bot_token)
bot.set_webhook()
@bot.message_handler(commands=['start'])
def handle_start(message):
bot.reply_to(message, "Привет! Это мой телеграм-бот!")
@app.route('/')
def index():
return render_template('index1.html')
@app.route('/login')
def login():
return render_template('auth/login.html')
@app.route('/login/<string:token>')
def login_token(token):
return render_template('auth/login.html')
if __name__ == '__main__':
Thread(target=bot.infinity_polling).start()
socketio.run(app, debug=True)
ошибка:
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 409. Description: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running