-2
私はディスボイスボットのコマンドリストを持っているので、後で変更または変更できます。誰かが不和にコマンドを書くと、コマンドリストにそのコマンドがあるかどうかを確認しようとしています。問題は、エラーが表示されることです。Discordボットコマンドリスト
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'ためのコマンド拡張をご覧ください:私はこれが何をしたいと考えています。そのドキュメントはほとんど存在しませんが、[example bot](https://github.com/Rapptz/discord.py/blob/master/examples/basic_bot.py)があります。 –