Skip to content

Instantly share code, notes, and snippets.

@fatiiates
Last active February 16, 2021 19:44
Show Gist options
  • Save fatiiates/ec378d5f6ce0014f94f0d86ad65c0e95 to your computer and use it in GitHub Desktop.
Save fatiiates/ec378d5f6ce0014f94f0d86ad65c0e95 to your computer and use it in GitHub Desktop.
# 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