Skip to content

Commit

Permalink
Move logs folder creation into code
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Mar 14, 2021
1 parent 4be7619 commit adebe83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ COPY pyproject.toml poetry.lock ./
RUN poetry install --no-dev

COPY . .
RUN mkdir logs
CMD ["python", "docker_launcher.py"]
5 changes: 2 additions & 3 deletions cogs/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ async def bot_check(self, ctx):
return True

bucket = self.cd.get_bucket(ctx.message)
retry_after = bucket.update_rate_limit()
if retry_after:
if retry_after := bucket.update_rate_limit():
raise commands.CommandOnCooldown(bucket, retry_after)

return True
Expand All @@ -53,7 +52,7 @@ async def send_dm(self, uid, content):
priv = await self.bot.http.start_private_message(uid)
await self.bot.http.send_message(priv["id"], content)

@tasks.loop(seconds=0.1)
@tasks.loop(seconds=0.5)
async def process_dms(self):
with await self.bot.redis as r:
req = await r.blpop("send_dm")
Expand Down
3 changes: 3 additions & 0 deletions cogs/logging.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
import logging

from discord.ext import commands
Expand All @@ -11,6 +12,8 @@ class Logging(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot

Path("logs").mkdir(exist_ok=True)

self.log = logging.getLogger(f"Cluster#{self.bot.cluster_name}")
handler = logging.FileHandler(f"logs/commands-{self.bot.cluster_name}.log")
handler.setFormatter(formatter)
Expand Down

0 comments on commit adebe83

Please sign in to comment.