Skip to content

Commit

Permalink
Добавить интенты (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
Deeplerg authored and inyutin-maxim committed Sep 26, 2019
1 parent 0019ef4 commit 4c39e2e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
13 changes: 13 additions & 0 deletions VkNet/Enums/SafetyEnums/Intent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace VkNet.Enums.SafetyEnums
{
/// <summary>
/// Метка, которая обозначает приблизительное содержание сообщения от сообщества
/// </summary>
public sealed class Intent : SafetyEnum<Intent>
{
/// <summary>
/// Интент, который должен сопровождать рекламную рассылку для ботов.
/// </summary>
public static readonly Intent PromoNewsletter = RegisterPossibleValue(value: "promo_newsletter");
}
}
14 changes: 12 additions & 2 deletions VkNet/Model/RequestParams/Messages/MessagesSendParams.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using VkNet.Enums.SafetyEnums;
using VkNet.Model.Attachments;
using VkNet.Model.Keyboard;
using VkNet.Utils;
using VkNet.Utils.JsonConverter;

namespace VkNet.Model.RequestParams
{
Expand Down Expand Up @@ -132,13 +134,20 @@ public class MessagesSendParams
[JsonProperty("captcha_key")]
[Obsolete(ObsoleteText.CaptchaNeeded)]
public string CaptchaKey { get; set; }

/// <summary>
/// 1 - отключить уведомление об упоминании в сообщении, может принимать значения 1 или 0, по умолчанию
/// </summary>
[JsonProperty("disable_mentions")]
public bool DisableMentions { get; set; }

/// <summary>
/// Метка, которая обозначает приблизительное содержание сообщения от сообщества
/// </summary>
[JsonProperty("intent")]
[JsonConverter(typeof(SafetyEnumJsonConverter))]
public Intent Intent { get; set; }

/// <summary>
/// Привести к типу VkParameters.
/// </summary>
Expand Down Expand Up @@ -166,7 +175,8 @@ public static VkParameters ToVkParameters(MessagesSendParams p)
{ "payload", p.Payload },
{ "group_id", p.GroupId },
{ "dont_parse_links", p.DontParseLinks },
{ "disable_mentions", p.DisableMentions }
{ "disable_mentions", p.DisableMentions },
{ "intent", p.Intent }
};
}
}
Expand Down

0 comments on commit 4c39e2e

Please sign in to comment.