Spaces:
Paused
Paused
Commit
β’
08baccf
1
Parent(s):
56d7fc2
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')
|