seawolf2357 commited on
Commit
440418c
·
verified ·
1 Parent(s): 08baccf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -3
app.py CHANGED
@@ -1,19 +1,28 @@
1
  import discord
 
2
 
3
- intents = discord.Intents.default() # 기본 intents 활성화
4
- intents.messages = True # 메시지 읽기에 대한 intents 활성화
 
 
 
 
 
 
5
 
6
  class MyClient(discord.Client):
7
  def __init__(self, *args, **kwargs):
8
  super().__init__(*args, **kwargs)
9
 
10
  async def on_ready(self):
11
- print(f'Logged on as {self.user}!')
12
 
13
  async def on_message(self, message):
14
  if message.author == self.user:
 
15
  return
16
  response = message.content + " hello"
 
17
  await message.channel.send(response)
18
 
19
  # 봇 객체 생성 및 실행
 
1
  import discord
2
+ import logging
3
 
4
+ # 로깅 설정
5
+ logging.basicConfig(level=logging.DEBUG,
6
+ format='%(asctime)s:%(levelname)s:%(name)s: %(message)s',
7
+ handlers=[logging.StreamHandler()]) # 로그를 콘솔에 출력
8
+
9
+ # Intents 생성
10
+ intents = discord.Intents.default()
11
+ intents.messages = True
12
 
13
  class MyClient(discord.Client):
14
  def __init__(self, *args, **kwargs):
15
  super().__init__(*args, **kwargs)
16
 
17
  async def on_ready(self):
18
+ logging.info(f'Logged on as {self.user}!')
19
 
20
  async def on_message(self, message):
21
  if message.author == self.user:
22
+ logging.info('Ignoring message from self.')
23
  return
24
  response = message.content + " hello"
25
+ logging.debug(f'Responding to message: {message.content}')
26
  await message.channel.send(response)
27
 
28
  # 봇 객체 생성 및 실행