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')  # ์—ฌ๊ธฐ์— ์•ˆ์ „ํ•˜๊ฒŒ ํ† ํฐ์„ ์ €์žฅํ•˜์„ธ์š”.