vknet / vk

Vkontakte API for .NET
https://vknet.github.io/vk/
MIT License
568 stars 222 forks source link

Новый ActionType для MessagesAction #1615

Closed X-Softer closed 6 months ago

X-Softer commented 6 months ago

В ответе на Messages.GetById Словил response.items[XX].action.type = "custom". Пример ответа:

.....
{
  "date": 1712685655,
  "from_id": 1111111,
  "id": 27,
  "out": 0,
  "version": 10556234,
  "action": {
      "type": "custom",
      "message": "Юлия  изменила оформление чата на «Стандартное»",
      "style": "mable"
  },
.....

При обработке падает исключение:

Exception occured while message watching: Newtonsoft.Json.JsonSerializationException: Error converting value "custom" to type 'System.Nullable`1[VkNet.Enums.StringEnums.MessageAction]'. Path 'response.items[68].action.type', line 1, position 1118681.
 ---> System.ArgumentException: Requested value 'custom' was not found.
   at Newtonsoft.Json.Utilities.EnumUtils.ParseEnum(Type enumType, NamingStrategy namingStrategy, String value, Boolean disallowNumber)
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Converters.StringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer)
   at VkNet.Utils.JsonConverter.TolerantStringEnumConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in D:\Work\Projects\My\VkMessagesCollector\VkNet\Utils\JsonConverter\TolerantStringEnumConverter.cs:line 23
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
   at VkNet.Utils.JsonConverter.VkCollectionJsonConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in D:\Work\Projects\My\VkMessagesCollector\VkNet\Utils\JsonConverter\VkCollectionJsonConverter.cs:line 110
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at VkNet.VkApi.Call[T](String methodName, VkParameters parameters, Boolean skipAuthorization, JsonConverter[] jsonConverters) in D:\Work\Projects\My\VkMessagesCollector\VkNet\VkApi.cs:line 310
   at VkNet.Categories.MessagesCategory.GetById(IEnumerable`1 messageIds, IEnumerable`1 fields, Nullable`1 previewLength, Nullable`1 extended, Nullable`1 groupId) in D:\Work\Projects\My\VkMessagesCollector\VkNet\Categories\MessagesCategory.cs:line 131

Наверное надо добавить Cusom в VkNet.Enums.StringEnums.MessageAction