seawolf2357 commited on
Commit
08baccf
β€’
1 Parent(s): 56d7fc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -1,18 +1,21 @@
1
  import discord
2
 
 
 
 
3
  class MyClient(discord.Client):
 
 
 
4
  async def on_ready(self):
5
  print(f'Logged on as {self.user}!')
6
 
7
  async def on_message(self, message):
8
- # λ©”μ‹œμ§€λ₯Ό 보낸 μ‚¬λžŒμ΄ 봇 μžμ‹ μ΄λ©΄ λ°˜μ‘ν•˜μ§€ μ•ŠμŒ
9
  if message.author == self.user:
10
  return
11
-
12
- # μž…λ ₯받은 ν…μŠ€νŠΈμ— "hello"λ₯Ό λ”ν•΄μ„œ 응닡
13
  response = message.content + " hello"
14
  await message.channel.send(response)
15
 
16
  # 봇 객체 생성 및 μ‹€ν–‰
17
- client = MyClient()
18
- client.run('your_token_here') # 여기에 μ•ˆμ „ν•˜κ²Œ 토큰을 μ €μž₯ν•˜μ„Έμš”.
 
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
  # 봇 객체 생성 및 μ‹€ν–‰
20
+ client = MyClient(intents=intents)
21
+ client.run('your_token_here')