telegram-mathbot/mathbot/__main__.py
2018-01-18 09:09:39 +01:00

27 lines
530 B
Python

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)