reorg to make better use of volumes

This commit is contained in:
jsl12
2022-01-28 00:22:33 -06:00
parent be3097ee8c
commit e7aa6b062c
11 changed files with 13 additions and 8 deletions

2
.gitignore vendored
View File

@@ -1,5 +1,5 @@
__pycache__
.env
src/.env
.idea
.ipynb_checkpoints
discord.py

View File

@@ -11,7 +11,6 @@ RUN pip install nextcord
RUN pip install beautifulsoup4 requests lxml
WORKDIR /usr/src/app
COPY ./ ./
WORKDIR /usr/app/src
CMD [ "python", "main.py" ]

View File

@@ -4,8 +4,13 @@ services:
container_name: kwaylon
image: kwaylon:latest
build: ./
restart: unless-stopped
network_mode: host
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro
restart: unless-stopped
- /mnt/dietpi_userdata/kwaylon/src:/usr/app/src
- /mnt/dietpi_userdata/kwaylon/data:/usr/app/data
# - type: bind
# source: /mnt/dietpi_userdata/kwaylon/messages.db
# target: /usr/src/app/messages.db

View File

@@ -1,3 +1,3 @@
from .jokes import Joke, GifJoke
from .kwaylon import Kwaylon
from .reactions import ReactionData
from .jokes import Joke, GifJoke

View File

@@ -7,8 +7,7 @@ from typing import List
import pandas as pd
from nextcord import Client, Message, TextChannel
from nextcord import Emoji
from nextcord import RawReactionActionEvent
from nextcord import RawReactionActionEvent, Emoji
from nextcord import utils
from . import jokes
@@ -20,10 +19,12 @@ LOGGER = logging.getLogger(__name__)
class Kwaylon(Client):
db_path: Path = Path('./messages.db')
# db_path: Path = Path(r'../data/messages.db')
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.limit, self.days = limit, days
self.jokes = list(jokes.collect_jokes())
self.lock = asyncio.Lock()