seawolf2357
commited on
Update app.py
Browse files
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')
|