이것은 내 코드입니다.
@client.command()
async def repeat(*args):
output = ''
for word in args:
output += str(word)
output += " "
await client.say(output)
client.say(output)
작동하지만 나는이 양식에 그것을 할 시도하지 않습니다 await message.channel.send(output)
그러나, 나는에 대한 넣어 모르는 message
내 함수의 매개 변수이기 때문에 *args
나는대로 넣을 수있는 다른 무언가가 있나요 message
?
먼저 컨텍스트를 전달할 수 있도록 명령에 대한 매개 변수가 있어야합니다.이 경우에는 ctx입니다. client.say()
더 이상 사용하고 싶은 것이 아닙니다. 코드를 약간 변경했습니다. 도움이 되길 바랍니다.
@client.command()
async def repeat(ctx, *args):
await ctx.send(' '.join(args))
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다