Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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') # μ¬κΈ°μ μμ νκ² ν ν°μ μ μ₯νμΈμ.
|