-2
불화 봇에 대한 명령 목록이 있으므로 나중에 변경하거나 수정할 수 있습니다. 누군가가 불화에 명령을 쓸 때 명령 목록에 있는지 확인하고 보려고합니다. 문제는 내가 오류가 발생했습니다 :불화 봇 명령 목록
for message.content.startswith in commands:
AttributeError: 'str' object attribute 'startswith' is read-only
이 방법이 있습니까? 어떻게하면 읽기 전용이 아닌가 ... 아니면 어떻게 해결할 수 있을까요?
코드 :
import discord, asyncio
client = discord.Client()
@client.event
async def on_ready():
print('logged in as: ', client.user.name, ' - ', client.user.id)
@client.event
async def on_message(message):
commands = ('!test', '!test1', '!test2')
for message.content.startswith in commands:
print('true')
if __name__ == '__main__':
client.run('token')
'discord.py'에 대한 명령 확장을보아야한다. 그 문서는 거의 존재하지 않지만 [예제 로봇] (https://github.com/Rapptz/discord.py/blob/master/examples/basic_bot.py)이 있습니다. –