Last active
February 16, 2021 19:44
-
-
Save fatiiates/ec378d5f6ce0014f94f0d86ad65c0e95 to your computer and use it in GitHub Desktop.
This file contains 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
# Mode ortam değişkeni | |
mode = os.getenv("MODE") | |
# Mod'a uyarlı, updater başlatma fonksiyonu belirler | |
if mode == "dev": | |
def run(updater): | |
print("Bot başlatıldı.") | |
updater.start_polling() | |
elif mode == "prod": | |
def run(updater): | |
# Port ve Uygulamanızın adını içeren ortam değişkenleri | |
PORT = int(os.environ.get("PORT", 8443)) | |
HEROKU_APP_NAME = os.environ.get("HEROKU_APP_NAME") | |
updater.start_webhook(listen="0.0.0.0", | |
port=PORT, | |
url_path=TOKEN) | |
updater.bot.set_webhook("https://{}.herokuapp.com/{}".format(HEROKU_APP_NAME, TOKEN)) | |
print("Bot başlatıldı.") | |
updater.idle() | |
else: | |
print("Bir mod seçilmedi") | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment