<commit_before>#!/bin/bash

if [[ "${BASH_SOURCE[0]}" == "$0" ]]
then
  exit 1
fi


function private::bastion_screen_name () {
  screen -ls | grep "\\.${NAME//./\\.}"
}


function method::debug () {
  if ! [[ $(private::bastion_screen_name) ]]
  then
    print::error "$NAME is already running!"
    print::info "Stop Bastion before you run it in dubug mode!"
  else
    node .
  fi
}

function method::fix-dependencies () {
  print::message "Fixing dependencies..."
  rm -rf node_modules package-lock.json
  npm i --only=production --no-package-lock
}

function method::fix-locales () {
  print::message "Fixing locales..."
  export LC_ALL="$LANG"
  grep -qF "LC_ALL=\"$LANG\"" /etc/environment || echo "LC_ALL=\"$LANG\"" | sudo tee -a /etc/environment 1>/dev/null
}

function method::help () {
  echo
  echo -e "${CYAN}Bastion${NC} - One of the best Discord Bot!"
  echo -e "Give awesome perks to your Discord Server!"
  echo
  echo -e "${GREEN}Usage:${NC}"
  echo " $0 --[OPTION]"
  echo
  echo -e "${GREEN}Options:${NC}"
  echo " --debug      Start Bastion in debug mode to see the issue that is"
  echo "              preventing Bastion from booting. Does not start Bastion in"
  echo "              background, so if you close the debug mode, Bastion stops."
  echo " --fix-d      Fixes dependencies issues by reinstalling dependencies."
  echo " --fix-l      Fixes locales issue that causes errors with youtube-dl."
  echo " --reset      Removes all the data stored by Bastion. Useful when you"
  echo "              want to start from scratch or if you have somehow"
  echo "              corrupted the database."
  echo " --restart    Restarts Bastion."
  echo " --show       Shows you real-time log of Bastion running in background."
  echo " --start      Starts Bastion in background - in a screen session -"
  echo "              which will keep running even if you close the terminal."
  echo " --status     Shows you if Bastion is running in the background or not."
  echo " --stop       Stops Bastion's process that is running in the background."
  echo " --update     Updates Bastion to the latest version without losing data."
  echo
  echo -e "${GREEN}Examples:${NC}"
  echo " $0 --start"
  echo " $0 --stop"
  echo " $0 --update"
  echo
}

function method::reset () {
  if [[ $(private::bastion_screen_name) ]]
  then
    print::error "$NAME is currently running."
    print::info "Stop Bastion before resetting the saved data."
  else
    print::message "Resetting Bastion..."

    if [ -r ./data/Bastion.db ]; then
      modifiedDate="$(date -r data/Bastion.db -u +%y%m%d%H%M)"
      print::message "Backing up database to backup_${modifiedDate}.db..."
      mv ./data/Bastion.db "./data/backup_${modifiedDate}.db"
    fi

    print::message "Removing saved data..."
    rm -fr ./data/Bastion.db ./package-lock.json ./screenlog.0
    print::message "Done."
    echo

    print::message "All the saved data was removed from Bastion."
  fi
}

function method::show () {
  if [[ $(private::bastion_screen_name) ]]
  then
    tail -f screenlog.0
  else
    print::info "$NAME is currently ${RED}stopped${NC}!"
  fi
}

function method::start () {
  if [[ $(private::bastion_screen_name) ]]
  then
    print::info "$NAME is already started."
  else
    print::message "Checking Bastion System..."
    if [ -r isndex.js ]
    then
      print::message "System check successful."
      echo

      print::message "Booting up..."

      screen -L -dmS "$NAME" /bin/bash -c "until node .; do sleep 1; done"

      print::info "$NAME was successfully started!"
    else
      print::error "System check failed."
      echo

      print::message "Check if you have installed Bastion correctly."
      print::message "Follow the installation guide: https://docs.bastionbot.org"
    fi
  fi
}

function method::status () {
  if [[ $(private::bastion_screen_name) ]]
  then
    print::info "$NAME is currently ${GREEN}running${NC}!"
  else
    print::info "$NAME is currently ${RED}stopped${NC}!"
  fi
}
<commit_msg>scripts: fix a typo in the methods.sh script<commit_after>#!/bin/bash

if [[ "${BASH_SOURCE[0]}" == "$0" ]]
then
  exit 1
fi


function private::bastion_screen_name () {
  screen -ls | grep "\\.${NAME//./\\.}"
}


function method::debug () {
  if ! [[ $(private::bastion_screen_name) ]]
  then
    print::error "$NAME is already running!"
    print::info "Stop Bastion before you run it in dubug mode!"
  else
    node .
  fi
}

function method::fix-dependencies () {
  print::message "Fixing dependencies..."
  rm -rf node_modules package-lock.json
  npm i --only=production --no-package-lock
}

function method::fix-locales () {
  print::message "Fixing locales..."
  export LC_ALL="$LANG"
  grep -qF "LC_ALL=\"$LANG\"" /etc/environment || echo "LC_ALL=\"$LANG\"" | sudo tee -a /etc/environment 1>/dev/null
}

function method::help () {
  echo
  echo -e "${CYAN}Bastion${NC} - One of the best Discord Bot!"
  echo -e "Give awesome perks to your Discord Server!"
  echo
  echo -e "${GREEN}Usage:${NC}"
  echo " $0 --[OPTION]"
  echo
  echo -e "${GREEN}Options:${NC}"
  echo " --debug      Start Bastion in debug mode to see the issue that is"
  echo "              preventing Bastion from booting. Does not start Bastion in"
  echo "              background, so if you close the debug mode, Bastion stops."
  echo " --fix-d      Fixes dependencies issues by reinstalling dependencies."
  echo " --fix-l      Fixes locales issue that causes errors with youtube-dl."
  echo " --reset      Removes all the data stored by Bastion. Useful when you"
  echo "              want to start from scratch or if you have somehow"
  echo "              corrupted the database."
  echo " --restart    Restarts Bastion."
  echo " --show       Shows you real-time log of Bastion running in background."
  echo " --start      Starts Bastion in background - in a screen session -"
  echo "              which will keep running even if you close the terminal."
  echo " --status     Shows you if Bastion is running in the background or not."
  echo " --stop       Stops Bastion's process that is running in the background."
  echo " --update     Updates Bastion to the latest version without losing data."
  echo
  echo -e "${GREEN}Examples:${NC}"
  echo " $0 --start"
  echo " $0 --stop"
  echo " $0 --update"
  echo
}

function method::reset () {
  if [[ $(private::bastion_screen_name) ]]
  then
    print::error "$NAME is currently running."
    print::info "Stop Bastion before resetting the saved data."
  else
    print::message "Resetting Bastion..."

    if [ -r ./data/Bastion.db ]; then
      modifiedDate="$(date -r data/Bastion.db -u +%y%m%d%H%M)"
      print::message "Backing up database to backup_${modifiedDate}.db..."
      mv ./data/Bastion.db "./data/backup_${modifiedDate}.db"
    fi

    print::message "Removing saved data..."
    rm -fr ./data/Bastion.db ./package-lock.json ./screenlog.0
    print::message "Done."
    echo

    print::message "All the saved data was removed from Bastion."
  fi
}

function method::show () {
  if [[ $(private::bastion_screen_name) ]]
  then
    tail -f screenlog.0
  else
    print::info "$NAME is currently ${RED}stopped${NC}!"
  fi
}

function method::start () {
  if [[ $(private::bastion_screen_name) ]]
  then
    print::info "$NAME is already started."
  else
    print::message "Checking Bastion System..."
    if [ -r index.js ]
    then
      print::message "System check successful."
      echo

      print::message "Booting up..."

      screen -L -dmS "$NAME" /bin/bash -c "until node .; do sleep 1; done"

      print::info "$NAME was successfully started!"
    else
      print::error "System check failed."
      echo

      print::message "Check if you have installed Bastion correctly."
      print::message "Follow the installation guide: https://docs.bastionbot.org"
    fi
  fi
}

function method::status () {
  if [[ $(private::bastion_screen_name) ]]
  then
    print::info "$NAME is currently ${GREEN}running${NC}!"
  else
    print::info "$NAME is currently ${RED}stopped${NC}!"
  fi
}

{'fraction_non_alphanumeric': 0.1362397820163488, 'fraction_numerical': 0.0027247956403269754, 'mean_word_length': 2.7610619469026547, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1038048', 'n_tokens_mistral': 2542, 'n_tokens_neox': 2484, 'n_words': 857}