Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # pip install flask-cors python-telegram-bot
- # - chat with @BotFather, create new bot ==> fill the TOKEN. (https://core.telegram.org/bots#6-botfather)
- # - Chat with new bot something ==> access to https://api.telegram.org/bot<TOKEN>/getUpdates ==> Copy the chat ID then # fill the argument below.
- # - Profits??
- import json
- from flask import Flask, request
- from flask_cors import CORS
- import telegram
- bot = telegram.Bot(token='TOKEN')
- app = Flask(__name__)
- CORS(app)
- @app.route("/")
- def hello_world():
- bot.send_message(chat_id='CHAT_ID', text=json.dumps(request.args))
- return "Hello, cross-origin-world!"
- if __name__ == '__main__':
- app.run(host='0.0.0.0', port=12333)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement