type=str,
                    required=True,
                    help="The path on which the script is located")
args = parser.parse_args()

PWD = args.path + '/' if not args.path.endswith(
    '/') else args.path  # working directory path
if not (os.path.isdir(PWD)):
    logger.error('The directory %s does not exist', PWD)
    exit()

NotifyDB = PWD + 'backup/users_notify.db'
db_worker = SQLighter(NotifyDB)

# If there is no table, then we create it.
result = db_worker.create_tabl('user_nodes')
db_worker.close()
if not result == 'Ok':
    logger.error(result)
    exit(1)

database_name = PWD + 'backup/users_address.db'  # database file name
if not (os.path.isfile(database_name)):
    logger.error('The file %s does not exist', database_name)
    exit()


# Record time to file
def write_last_time(time_now):
    try:
        with open(PWD + "LastCheckTime.txt", 'w') as f:
coin_keyboard = [['gbx', 'pac', 'dev', 'bwk'], ['bitg', 'nrg', 'xzc', 'mnp'],
                 ['cancel']]
coin_markup = ReplyKeyboardMarkup(coin_keyboard,
                                  one_time_keyboard=True,
                                  resize_keyboard=True)

# Create a keyboard of cancel.
cancel_keyboard = [['cancel']]
cancel_markup = ReplyKeyboardMarkup(cancel_keyboard,
                                    one_time_keyboard=True,
                                    resize_keyboard=True)

db_worker = SQLighter(database_name)

# If there is no table, then we create it.
db_worker.create_tabl('users_address')
db_worker.close()


# command method "/start"
def start(bot, update):
    update.message.reply_text(
        'The bot is used for the 2masternodes.com service. The bot checks the status of the node at the wallet address from which the coins were sent to the node.\n'
        'If the bot does not respond, enter /start or "Clear Chat History" and then /start.\n'
        'To obtain statistics on the price of coins in the BTC and USD, a site is used - https://min-api.cryptocompare.com. '
        'The cost of invested coins is taken at the time of the start of the node.\n'
        "/start - start bot\n"
        "/help - help\n"
        "/status - show masternodes status\n"
        "/balance - show coin balance by address\n"
        "/address - show coin addresses\n"