Spaces:
Runtime error
Runtime error
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') # ์ฌ๊ธฐ์ ์์ ํ๊ฒ ํ ํฐ์ ์ ์ฅํ์ธ์.
|