mirror of
https://github.com/majmongoose/PageBot.git
synced 2024-11-08 02:16:04 -05:00
Add TTD watchdog
This commit is contained in:
parent
d52c40f557
commit
1371411f62
17
pagebot.py
17
pagebot.py
@ -93,6 +93,19 @@ async def upload_to_discord(mp4_file,text):
|
||||
else:
|
||||
print(f"Could not find channel with ID {channel}")
|
||||
|
||||
def launch_and_watch(program_path):
|
||||
while True:
|
||||
process = subprocess.Popen(program_path)
|
||||
process.wait()
|
||||
if process.returncode != 0:
|
||||
print("TTD has crashed. Relaunching...")
|
||||
else:
|
||||
print("TTD has exited normally.")
|
||||
break
|
||||
|
||||
# Wait for a few seconds before relaunching
|
||||
time.sleep(5)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
## initialize watchdogs
|
||||
@ -101,11 +114,15 @@ if __name__ == "__main__":
|
||||
observer.schedule(event_handler, secrets_file.watch_folder, recursive=False)
|
||||
observer.start()
|
||||
|
||||
## Launch TTD
|
||||
launch_and_watch(secrets_file.ttd_path)
|
||||
|
||||
## initialize discord
|
||||
intents = discord.Intents.default()
|
||||
intents.message_content = True
|
||||
client = discord.Client(intents=intents)
|
||||
client.run(secrets_file.key)
|
||||
|
||||
|
||||
try:
|
||||
while True:
|
||||
|
@ -1,5 +1,12 @@
|
||||
## TwoToneDetect Executable Path
|
||||
ttd_path = "C:\\PATH\\TO\\TTD.exe"
|
||||
## Discord Bot Token
|
||||
key = 'Bot Token'
|
||||
## Folder to Watch for output audio
|
||||
watch_folder = '/path/to/folder'
|
||||
## Discord Channel ID to send notifications
|
||||
channel_id = channel_id_number
|
||||
## Generally a good idea.
|
||||
delete_after_upload=True
|
||||
## This will slow down pages and is unreliable.
|
||||
speech_to_text = True
|
Loading…
Reference in New Issue
Block a user