当我决定将它托管在我的 Raspberry pi 4B 上时,我正在制作一个 Discord 机器人。我转移了我的文件,下载了 Python 3.8,做了所有必要的仪式。然后,我决定运行我的机器人。当我不断遇到线程问题时,一切似乎都很好。一遍又一遍,穿线,穿线,穿线。我在我的 on_message 事件中得到它,这是它的代码。它也在一个齿轮中。如果重要的话,将 aiosqlite 用于我的数据库和 .db 文件扩展名。
@commands.Cog.listener()
async def on_message(self, message):
db = await aiosqlite.connect('aichannels.db')
cursor = await db.cursor()
await cursor.execute(f'SELECT channel_id FROM main WHERE guild_id = {message.channel.guild.id}')
result = await cursor.fetchone()
if message.author.bot:
return
else:
if result is None:
return
else:
if message.channel.id == result[0]:
await message.channel.trigger_typing()
response = await rs.get_ai_response(message.content)
await message.reply(response)
else:
return
await self.client.process_commands(message)
await cursor.close()
await db.close()
这是我得到的错误:
Ignoring exception in on_message
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "/home/pi/ConchBot/cogs/Fun.py", line 16, in on_message
db = await aiosqlite.connect('aichannels.db')
File "/home/pi/.local/lib/python3.7/site-packages/aiosqlite/core.py", line 146, in await
self.start()
File "/usr/lib/python3.7/threading.py", line 847, in start
_start_new_thread(self._bootstrap, ())
另外,刚才,我不再收到错误,并且出现了这个:
^CSSL error in data received
protocol: <asyncio.sslproto.SSLProtocol object at 0xb55a3ed0>
transport: <_SelectorSocketTransport fd=7 read=polling write=<idle, bufsize=0>>
Traceback (most recent call last):
File "/usr/lib/python3.7/asyncio/sslproto.py", line 526, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/usr/lib/python3.7/asyncio/sslproto.py", line 207, in feed_ssldata
self._sslobj.unwrap()
File "/usr/lib/python3.7/ssl.py", line 767, in unwrap
return self._sslobj.shutdown()
ssl.SSLError: [SSL: KRB5_S_INIT] application data after close notify (_ssl.c:2609)
我对 Raspberry Pi 托管有点陌生,不知道这意味着什么。如果有人可以帮助我,我会非常感激。谢谢!