diff --git a/.gitignore b/.gitignore index d550652..1352deb 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,6 @@ wheels/ .idea/ *.swp *.swo +*.db *.log diff --git a/cogs/funchosa_parser.py b/cogs/funchosa_parser.py index 12d0b15..19a57be 100644 --- a/cogs/funchosa_parser.py +++ b/cogs/funchosa_parser.py @@ -83,6 +83,9 @@ class FunchosaParser(commands.Cog): async def cog_load(self): await self.db.init_db() logger.info("FunchosaParser initialized") + asyncio.ensure_future(self._startup()) + + async def _startup(self): await self.bot.wait_until_ready() await self.auto_parse_on_startup() diff --git a/config.py b/config.py index 41a1842..6418072 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,3 @@ -python import os from dotenv import load_dotenv @@ -7,7 +6,6 @@ load_dotenv() TOKEN = os.getenv('DISCORD_TOKEN') CHANNEL_ID = 1454107749028855971 # roles channel -roles_message_id = 1454128857102680187 FUNCHOSA_CHANNEL_ID = 1379127661095551048 REACTION_ROLES = { @@ -41,3 +39,4 @@ HELP_TEXT = ( "префикс: `!`\n" "в лс отпишите по предложениям че в бота докинуть" ) + diff --git a/data/funchosa.db b/data/funchosa.db index 8b13789..2ad90bb 100644 Binary files a/data/funchosa.db and b/data/funchosa.db differ diff --git a/data/role_message_id.json b/data/role_message_id.json new file mode 100644 index 0000000..178aefd --- /dev/null +++ b/data/role_message_id.json @@ -0,0 +1 @@ +{"message_id": 1454128857102680187} \ No newline at end of file diff --git a/utils/data_manager.py b/utils/data_manager.py index 4c519e2..834bc73 100644 --- a/utils/data_manager.py +++ b/utils/data_manager.py @@ -1,17 +1,18 @@ import json import os -from config import roles_message_id + +DATA_FILE = 'data/role_message_id.json' def save_message_id(message_id): os.makedirs('data', exist_ok=True) - with open(roles_message_id, 'w') as f: + with open(DATA_FILE, 'w') as f: json.dump({'message_id': message_id}, f) def load_message_id(): try: - with open(roles_message_id, 'r') as f: + with open(DATA_FILE, 'r') as f: data = json.load(f) - return data.get('message_id') + return data.get('message_id') except FileNotFoundError: return None except json.JSONDecodeError: