Skip to content

Commit

Permalink
chore: 로그 포맷팅, 버전업 (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
Whitetiger0423 authored Dec 17, 2024
2 parents 25e33e6 + d08749d commit 9fd48e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import dotenv
import logging
import utils.logging
from discord.ext import commands
from discord.ext import commands, tasks
import time
from asyncio import sleep
import pickle
Expand All @@ -25,10 +25,15 @@ async def on_ready():
logger.info(f"Logged in as {bot.user.name}")
logger.info(f"Be used in {guild_count} guilds.")

change_status.start()


@tasks.loop(seconds=5)
async def change_status():
await bot.change_presence(
status=discord.Status.online,
activity=discord.Game(f"버전 0.0.0 - {guild_count}개의 서버에서 작동 중"),
)
activity=discord.Game(f"버전 0.1.0 - {len(bot.guilds)}개의 서버에서 작동 중"),
)


# Timer
Expand Down
3 changes: 2 additions & 1 deletion utils/logging.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import sys

RESET = "\033[0m"
CYAN = "\033[1;36m"
Expand Down Expand Up @@ -30,6 +31,6 @@ def format(self, record: logging.LogRecord):

def setup_logging():
formatter = HighlightingFormatter("{asctime} {levelname} {name}: {message}", "%Y-%m-%d %H:%M:%S", "{")
handler = logging.StreamHandler()
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(formatter)
logging.basicConfig(handlers=[handler], level=logging.INFO)

0 comments on commit 9fd48e5

Please sign in to comment.