seawolf2357 commited on
Commit
440418c
โ€ข
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
  # ๋ด‡ ๊ฐ์ฒด ์ƒ์„ฑ ๋ฐ ์‹คํ–‰