telegram-mathbot/mathbot/__main__.py

27 lines
530 B
Python
Raw Normal View History

2018-01-18 08:09:39 +00:00
from .main import main
import sys, logging
if( __name__ == "__main__"):
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO)
logger = logging.getLogger(__name__)
if(len(sys.argv) < 2):
print("E: missing bot api token file")
print(" usage:")
print(" {} <token file>".format(sys.argv[0]))
sys.exit(1)
try:
f = open(sys.argv[1])
token = f.read().strip()
f.close()
except:
print("E: failed to open and read token file")
sys.exit(1)
main(token)