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') # μ¬κΈ°μ μμ νκ² ν ν°μ μ μ₯νμΈμ. | |