45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
# Copyright (c) 2018 Daniel Knüttel #
|
|
# #
|
|
# This file is part of mathbot. #
|
|
# #
|
|
# mathbot is free software: you can redistribute it and/or modify #
|
|
# it under the terms of the GNU General Public License as published by #
|
|
# the Free Software Foundation, either version 3 of the License, or #
|
|
# (at your option) any later version. #
|
|
# #
|
|
# mathbot is distributed in the hope that it will be useful, #
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
|
# GNU General Public License for more details. #
|
|
# #
|
|
# You should have received a copy of the GNU General Public License #
|
|
# along with mathbot. If not, see <http://www.gnu.org/licenses/>. #
|
|
# #
|
|
|
|
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)
|