mirror of
https://github.com/andwati/unsplash-bot.git
synced 2026-11-21 01:58:48 +00:00
setup basic bot
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
from flask import Flask
|
||||
|
||||
from unsplashbot.config import TELEGRAM_TOKEN
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
WEBHOOK_URL_PATH = "/{}".format(TELEGRAM_TOKEN)
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import telebot
|
||||
from config import TELEGRAM_TOKEN
|
||||
|
||||
bot = telebot.TeleBot(TELEGRAM_TOKEN)
|
||||
|
||||
|
||||
@bot.message_handler(commands=["start", "hello"])
|
||||
def send_welcome(message):
|
||||
bot.reply_to(message, "Hello, I'm a bot!")
|
||||
|
||||
|
||||
@bot.message_handler(func=lambda msg: True)
|
||||
def echo_all(message):
|
||||
bot.reply_to(message, message.text)
|
||||
|
||||
|
||||
bot.infinity_polling()
|
||||
@@ -0,0 +1,7 @@
|
||||
import os
|
||||
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
TELEGRAM_TOKEN = os.getenv("TELEGRAM_TOKEN")
|
||||
Reference in New Issue
Block a user