我正在使用 Discord 模塊來制作一個不和諧的機(jī)器人。我很不擅長這個,因為我不久前開始編碼。嗯,我有一些問題設(shè)置機(jī)器人前綴:它說,有一個在8號線的錯誤..unclosed client session并且NameError: name 'command' is not defined為好。這是錯誤:Traceback (most recent call last):File "SUBLIME TEXT PRUEBA.py", line 8, in <module>client = command.Bot(command_prefix = '!')NameError: name 'command' is not definedUnclosed client sessionclient_session: <aiohttp.client.ClientSession object at 0x0000017638A4F9E8>我也要把代碼放在這里...import discordfrom discord.ext.commands import Botfrom discord.ext import commandsimport asyncioClient = discord.Client()client = command.Bot(command_prefix = '!')@client.eventasync def on_ready(): print('bot is redey')@client.eventasync def on_message(message): if message.content == 'keke': await client.send_message(message.channel, 'KEKEKEKEKK')
1 回答

飲歌長嘯
TA貢獻(xiàn)1951條經(jīng)驗 獲得超3個贊
正如評論中所討論的:
你需要使用
commands
而不是command
您的
discord.Client()
會話需要關(guān)閉,可能使用類似的方法close()
添加回答
舉報
0/150
提交
取消