File size: 591 Bytes
78efe79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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')  # 여기에 μ•ˆμ „ν•˜κ²Œ 토큰을 μ €μž₯ν•˜μ„Έμš”.