누군가 "개"라고 말할 때마다 내 불화 봇이 이미지 그룹에서 임의의 이미지를 보내도록 만들고 싶습니다. 내가 가진 것은 다음과 같습니다.
@client.event
async def on_message(message):
if message.content.startswith('dog'):
await message.channel.send(file=discord.File(random.choice('dog1.JPG', 'dog2.JPG', 'dog3.JPG')))
작동하지 않는 것 같습니다. 아이디어가 있습니까?
random.choice
개별 항목이 아닌 일련의 항목을 인수로 선택합니다. 해야 할 일random.choice(('dog1.JPG', 'dog2.JPG', 'dog3.JPG'))
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다