Created
April 7, 2023 09:29
-
-
Save cra/6ac9b1d6620c0d8d826d2dc94c97a468 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/app.py b/app.py | |
index f3d9ca8..ead69c0 100755 | |
--- a/app.py | |
+++ b/app.py | |
@@ -10,19 +10,14 @@ from telegram import Update | |
from wtforms import StringField, TextField | |
from wtforms.validators import DataRequired | |
-from bot import create_dispatcher, register_handlers | |
from highlighter import make_image, get_languages | |
from logic import get_random_bg | |
from uploader import gen_name_uniq, UPLOAD_DIR | |
app = Flask(__name__) | |
app.config['SECRET_KEY'] = os.environ.get("FLASK_SECRET") | |
-TG_TOKEN = os.environ.get("TG_TOKEN") | |
csrf = CSRFProtect(app) | |
-bot, queue, dp = create_dispatcher(TG_TOKEN) | |
-register_handlers(dp) | |
- | |
class MyForm(FlaskForm): | |
language = StringField('language') | |
@@ -60,21 +55,6 @@ def custom_static(filename): | |
return render_template("not_found.html"), 404 | |
[email protected]('/hook/' + TG_TOKEN, methods=['POST']) | |
[email protected] | |
-def tg_webhook(): | |
- logging.info("tg_webhook") | |
- data = request.get_json(force=True) | |
- logging.info(data) | |
- update = Update.de_json(data, bot=bot) | |
- dp.process_update(update) | |
- return "OK" | |
- | |
- | |
[email protected]('/hook/' + TG_TOKEN, methods=['GET']) | |
-def webhook_get(): | |
- return redirect("https://telegram.me/links_forward_bot", code=302) | |
- | |
if __name__ == '__main__': | |
logging.basicConfig(level=logging.INFO) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment