| 1234567891011121314151617181920212223242526272829303132333435 |
- """
- Rocketbot Discord bot. Relies on a configured config.py (copy config.sample.py
- for a template).
-
- Author: Ian Albert (@rocketsoup)
- Date: 2021-11-11
- """
- import sys
-
- MIN_PYTHON_VERSION = (3, 10, 0)
- if sys.version_info < MIN_PYTHON_VERSION:
- ver = sys.version_info
- raise RuntimeError(f'rocketbot requires Python {MIN_PYTHON_VERSION[0]}.{MIN_PYTHON_VERSION[1]}.{MIN_PYTHON_VERSION[2]} '
- f'or greater. Detected {ver[0]}.{ver[1]}.{ver[2]}.')
-
- import asyncio # noqa: E402
-
- from config import CONFIG # noqa: E402
- from rocketbot.bot import start_bot # noqa: E402
- from rocketbot.utils import bot_log # noqa: E402
-
- CURRENT_CONFIG_VERSION = 4
- if (CONFIG.get('__config_version') or 0) < CURRENT_CONFIG_VERSION:
- # If you're getting this error, it means something changed in config.py's
- # format. Consult config.sample.py and compare it to your own config.py.
- # Rename/move any values as needed. When satisfied, update "__config_version"
- # to the value in config.sample.py. ...I know, pretty janky migration process.
- raise RuntimeError('config.py format may be outdated. Review ' +
- 'config.sample.py, update the "__config_version" field to ' +
- f'{CURRENT_CONFIG_VERSION}, and try again.')
-
- try:
- asyncio.run(start_bot())
- except KeyboardInterrupt:
- bot_log(None, None, 'Stopping bot due to Ctrl+C key')
|