Skip to content

Commit e5efae7

Browse files
committed
feat(main.py): add check for interactive mode before starting console input
This change allows the bot to run in non-interactive environments without waiting for console input.
1 parent 4c9f905 commit e5efae7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tux/main.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import concurrent.futures
33
import os
4+
import sys
45
from typing import Any
56

67
import discord
@@ -71,6 +72,8 @@ async def change_activity(self) -> None:
7172
# coroutine for console commands
7273
# loops user input and executes commands
7374
async def console(self) -> None:
75+
if not os.isatty(sys.stdin.fileno()):
76+
logger.info("Running in a non-interactive mode. Skipping console input.")
7477
logger.info("Console is ready. Type 'help' for a list of commands.")
7578
while True:
7679
# Use asyncio.run_in_executor to run input in a separate thread

0 commit comments

Comments
 (0)