Spaces:
Runtime error
Runtime error
File size: 940 Bytes
78efe79 440418c 78efe79 440418c 08baccf 78efe79 08baccf 78efe79 440418c 78efe79 440418c 78efe79 440418c 78efe79 08baccf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import discord
import logging
# 로깅 설정
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s:%(levelname)s:%(name)s: %(message)s',
handlers=[logging.StreamHandler()]) # 로그를 콘솔에 출력
# Intents 생성
intents = discord.Intents.default()
intents.messages = True
class MyClient(discord.Client):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
async def on_ready(self):
logging.info(f'Logged on as {self.user}!')
async def on_message(self, message):
if message.author == self.user:
logging.info('Ignoring message from self.')
return
response = message.content + " hello"
logging.debug(f'Responding to message: {message.content}')
await message.channel.send(response)
# 봇 객체 생성 및 실행
client = MyClient(intents=intents)
client.run('your_token_here')
|