def main():
from pip import main as pip_main
print("Setting up SpinEverydayBot...")
ver = version.split()[0].split('.')
if not (int(ver[0]) >= 3 and int(ver[1]) >= 6):
exit("ERROR: You need to install Python 3.6 or newer to use this bot")
try:
import telegram
except ImportError:
print("WARNING: 'python-telegram-bot' package is not installed. Installing...")
if pip_main(['install', 'python-telegram-bot']) != 0:
exit("""ERROR: An error occurred while installing packages.
Check that you're running this script as root or administrator""")
import telegram
del telegram
try:
import TeleSocketClient
del TeleSocketClient
except ImportError:
if input("Do you want to use TeleSocket Service? (y/N): ").lower().strip() == "y":
print("WARNING: 'TeleSocketClient' package is not installed. Installing...")
if pip_main(['install', 'TeleSocketClient']) != 0:
exit("""ERROR: An error occurred while installing packages.
Check that you're running this script as root or administrator""")
import TeleSocketClient
del TeleSocketClient
if not path.exists("config.py"):
print("WARNING: 'config.py' doesn't exist, copying example...")
copy("config_example.py", "config.py")
input("Now change example values to yours in file 'config.py' and press <Enter>")
check_config()
print("Setup finished")
print("Now you can run your bot via 'python3.6 bot.py' command")
exit(0)
评论列表
文章目录