JHue58 / ChatLearning

基于mirai-api-http,让bot学会你的群的说话方式
GNU Affero General Public License v3.0
316 stars 21 forks source link

启用新特性“文字转语音后”概率性报错 #20

Closed fatinghenji closed 2 years ago

fatinghenji commented 2 years ago

报错代码如下:

[{'type': 'Plain', 'text': '不愧是我'}]Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/root/ChatLearning.Linux/ChatReply.py", line 248, in main
    listening(data)
  File "/root/ChatLearning.Linux/ChatReply.py", line 241, in listening
    replyanswer(data, group, answer)  # 让bot回复
  File "/root/ChatLearning.Linux/ChatReply.py", line 185, in replyanswer
    if getconfig(5)==1 and runchance(getconfig(6))==1:
  File "/root/ChatLearning.Linux/ChatReply.py", line 123, in getconfig
    voicereply=config['voicereply']
KeyError: 'voicereply'
JHue58 commented 2 years ago

用voicereply把语音回复开关一下,然后设置个概率,就可以了

fatinghenji commented 2 years ago

用voicereply把语音回复开关一下,然后设置个概率,就可以了

少放了两行报错(

ChatLearning ->voicereply 20
<-已设置语音回复的触发概率 20 %
[{'type': 'Plain', 'text': '不愧是我'}]Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/root/ChatLearning.Linux/ChatReply.py", line 248, in main
    listening(data)
  File "/root/ChatLearning.Linux/ChatReply.py", line 241, in listening
    replyanswer(data, group, answer)  # 让bot回复
  File "/root/ChatLearning.Linux/ChatReply.py", line 185, in replyanswer
    if getconfig(5)==1 and runchance(getconfig(6))==1:
  File "/root/ChatLearning.Linux/ChatReply.py", line 123, in getconfig
    voicereply=config['voicereply']
KeyError: 'voicereply'

我先去试试