OlivOS-Team / OlivOS

OlivOS / Witness Union,一个强大的跨平台交互栈与机器人框架
https://doc.olivos.wiki
GNU Affero General Public License v3.0
185 stars 26 forks source link

features: 请求适配对接Lagrange.Core #117

Open sangxiang1 opened 6 months ago

sangxiang1 commented 6 months ago

需求描述:使用ONEBOT11/HTTP连接Lagrange.Core,接受消息及事件正常,发送消息不兼容出现异常,请求兼容适配 问题截图: image 问题日志:info: Lagrange.OneBot.Core.Network.Service.HttpService[0] Receive(Conn: 814a00bd-af03-42b1-8d26-5bd633ac6dfe: {"action":"send_msg","params":{"message_type": "group", "user_id": -1, "group_id": "473625090", "message": "[桑相]掐指一算: 1D100=14", "auto_escape": false}}) warn: Lagrange.OneBot.Core.Operation.OperationService[0] Unexpected error encountered while handling message. System.Text.Json.JsonException: The JSON value could not be converted to System.Nullable1[System.UInt32]. Path: $.user_id | LineNumber: 0 | BytePositionInLine: 36. ---> System.FormatException: Either the JSON value is not in a supported format, or is out of bounds for a UInt32. at System.Text.Json.ThrowHelper.ThrowFormatException(NumericType numericType) at System.Text.Json.Utf8JsonReader.GetUInt32() at System.Text.Json.Serialization.Converters.NullableConverter1.ReadNumberWithCustomHandling(Utf8JsonReader& reader, JsonNumberHandling numberHandling, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.Metadata.JsonPropertyInfo1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) --- End of inner exception stack trace --- at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.Serialization.Metadata.JsonTypeInfo1.DeserializeAsObject(Utf8JsonReader& reader, ReadStack& state) at System.Text.Json.JsonSerializer.ReadAsObject(Utf8JsonReader& reader, JsonTypeInfo jsonTypeInfo) at Lagrange.OneBot.Core.Entity.Action.OneBotMessageConverter4.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options) at System.Text.Json.Serialization.JsonConverter1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonConverter1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan1 utf8Json, JsonTypeInfo1 jsonTypeInfo, Nullable1 actualByteCount) at System.Text.Json.JsonSerializer.ReadFromNode[TValue](JsonNode node, JsonTypeInfo1 jsonTypeInfo) at Lagrange.OneBot.Core.Operation.Message.SendMessageOperation.HandleOperation(BotContext context, JsonNode payload) at Lagrange.OneBot.Core.Operation.OperationService.HandleOperation(MsgRecvEventArgs e)

kagangtuya-star commented 6 months ago

对接Lagrange.Core时出现以下错误:

OlivOS 插件 [OlivaDiceCore] 调用 [group_message] 失败: 'list' object has no attribute 'lower'
Traceback (most recent call last):
  File "OlivOS\core\core\pluginAPI.py", line 304, in plugin_event_router
  File "C:\Users\Administrator\Desktop\dnd_starchen_dice\KOOK\OlivOS-Win\./plugin/tmp\OlivaDiceCore\main.py", line 31, in group_message
  File "C:\Users\Administrator\Desktop\dnd_starchen_dice\KOOK\OlivOS-Win\./plugin/tmp\OlivaDiceCore\msgReply.py", line 202, in unity_reply
  File "C:\Users\Administrator\Desktop\dnd_starchen_dice\KOOK\OlivOS-Win\./plugin/tmp\OlivaDiceCore\msgReply.py", line 5361, in isMatchWordStart
AttributeError: 'list' object has no attribute 'lower'

接受消息事件正常,但每一条消息都报出此错误。