-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: unify discord and reddit bots (#264)
- Loading branch information
1 parent
fdec679
commit 6300eff
Showing
17 changed files
with
570 additions
and
57 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,6 @@ tests/ | |
|
||
# ignore venv when building locally | ||
venv/ | ||
|
||
data/ | ||
sample.env |
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
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
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
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
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
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
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# standard imports | ||
import os | ||
import time | ||
|
||
# development imports | ||
from dotenv import load_dotenv | ||
load_dotenv(override=False) # environment secrets take priority over .env file | ||
|
||
# local imports | ||
if True: # hack for flake8 | ||
import discord_bot | ||
import keep_alive | ||
import reddit_bot | ||
|
||
|
||
def main(): | ||
# to run in replit | ||
try: | ||
os.environ['REPL_SLUG'] | ||
except KeyError: | ||
pass # not running in replit | ||
else: | ||
keep_alive.keep_alive() # Start the web server | ||
|
||
discord_bot.start() # Start the discord bot | ||
reddit_bot.start() # Start the reddit bot | ||
|
||
try: | ||
while discord_bot.bot_thread.is_alive() or reddit_bot.bot_thread.is_alive(): | ||
time.sleep(0.5) | ||
except KeyboardInterrupt: | ||
print("Keyboard Interrupt Detected") | ||
discord_bot.stop() # Stop the discord bot | ||
reddit_bot.stop() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Oops, something went wrong.