seawolf2357 commited on
Commit
78efe79
β€’
1 Parent(s): 26dafea

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
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') # 여기에 μ•ˆμ „ν•˜κ²Œ 토큰을 μ €μž₯ν•˜μ„Έμš”.