Skip to content

Commit

Permalink
Add heroku deployment
Browse files Browse the repository at this point in the history
fabiosangregorio committed Jun 15, 2021
1 parent a55a042 commit 6a6a59c
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pyreddit
Submodule pyreddit updated 1 files
+1 −0 requirements.txt
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
-r pyreddit/requirements/requirements.txt
-r telereddit/requirements/requirements.txt
-r requirements/requirements.txt
19 changes: 11 additions & 8 deletions telereddit/telereddit.py
Original file line number Diff line number Diff line change
@@ -88,11 +88,14 @@ def init() -> str:
if env is None or len(env) == 0:
raise Exception("No REDDIT_BOTS_MACHINE env variable found.")

load_dotenv(
dotenv_path=os.path.join(
os.path.dirname(__file__), f"config/{env.lower()}.env"
try:
load_dotenv(
dotenv_path=os.path.join(
os.path.dirname(__file__), f"config/{env.lower()}.env"
)
)
)
except Exception as e:
print(e)

ServicesWrapper.init_services()
return env
@@ -118,9 +121,9 @@ def main() -> None:
dispatcher.add_handler(MessageHandler(Filters.all, on_chat_message))
dispatcher.add_handler(CallbackQueryHandler(on_callback_query))
updater.start_webhook(
listen="0.0.0.0", port=5000, url_path=os.getenv("TELEGRAM_TOKEN")
)
updater.bot.setWebhook(
"https://telereddit.herokuapp.com/" + os.getenv("TELEGRAM_TOKEN")
listen="0.0.0.0",
port=int(os.environ.get("PORT", "8443")),
url_path=os.getenv("TELEGRAM_TOKEN"),
webhook_url=f"https://telereddit.herokuapp.com/{os.getenv('TELEGRAM_TOKEN')}",
)
updater.idle()

0 comments on commit 6a6a59c

Please sign in to comment.