optimized kwalyon's container building
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import re
|
||||
import sqlite3
|
||||
from datetime import timedelta, datetime
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
@@ -23,7 +24,7 @@ class Kwaylon(Client):
|
||||
|
||||
def __init__(self, limit: int = 5000, days: int = 30, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.db_path = Path.cwd().parents[0] / 'data' / 'messages.db'
|
||||
self.db_path = Path.cwd() / 'data' / 'messages.db'
|
||||
|
||||
self.limit, self.days = limit, days
|
||||
self.jokes = list(jokes.collect_jokes())
|
||||
@@ -54,8 +55,12 @@ class Kwaylon(Client):
|
||||
|
||||
# await alive()
|
||||
|
||||
self.data = ReactionData(self.db_path)
|
||||
self.data.read_all()
|
||||
try:
|
||||
self.data = ReactionData(self.db_path)
|
||||
self.data.read_all()
|
||||
except sqlite3.Error as e:
|
||||
LOGGER.exception(e)
|
||||
LOGGER.error(f'self.db_path: {self.db_path}')
|
||||
|
||||
async def handle_message(self, message: Message):
|
||||
if message.author != self.user:
|
||||
|
||||
Reference in New Issue
Block a user