You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
762 B

10 months ago
import telebot
### LOAD TOKEN ###
import json, os
if not os.path.exists('db.json'):
db = {"token": "None"}
js = json.dumps(db, indent=2)
with open("db.json", "w") as outfile:
outfile.write(js)
print('Input token in "None" (db.json)')
exit()
with open('db.json', 'r') as openfile:
db = json.load(openfile)
API_TOKEN = db["token"]
bot = telebot.TeleBot(API_TOKEN)
##################
@bot.message_handler(commands=['help', 'start'])
def send_welcome(message):
bot.reply_to(message, "None")
### MAIN ###
from api import *
@bot.message_handler(func=lambda message: True)
def echo_message(message):
bot.send_chat_action(message.chat.id, "typing", 30)
bot.reply_to(message, gen(message.text, message.chat.id))
############
bot.infinity_polling()