seawolf2357's picture
Create app.py
78efe79 verified
raw
history blame
591 Bytes
import discord
class MyClient(discord.Client):
async def on_ready(self):
print(f'Logged on as {self.user}!')
async def on_message(self, message):
# λ©”μ‹œμ§€λ₯Ό 보낸 μ‚¬λžŒμ΄ 봇 μžμ‹ μ΄λ©΄ λ°˜μ‘ν•˜μ§€ μ•ŠμŒ
if message.author == self.user:
return
# μž…λ ₯받은 ν…μŠ€νŠΈμ— "hello"λ₯Ό λ”ν•΄μ„œ 응닡
response = message.content + " hello"
await message.channel.send(response)
# 봇 객체 생성 및 μ‹€ν–‰
client = MyClient()
client.run('your_token_here') # 여기에 μ•ˆμ „ν•˜κ²Œ 토큰을 μ €μž₯ν•˜μ„Έμš”.