当前位置: 首页>>代码示例>>C#>>正文


C# ParseMode.ToString方法代码示例

本文整理汇总了C#中ParseMode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ParseMode.ToString方法的具体用法?C# ParseMode.ToString怎么用?C# ParseMode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParseMode的用法示例。


在下文中一共展示了ParseMode.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendMessageAsync

        /// <summary>Sends a text message.</summary>
        /// <param name="chatId">
        /// Unique identifier for the message recipient or username of the target channel (in the format
        /// @channelusername).
        /// </param>
        /// <param name="text">Text of the message to be sent.</param>
        /// <param name="parseMode">
        /// Indicates the way that the Telegram should parse the sent message.
        /// </param>
        /// <param name="disableWebPagePreview">
        /// if set to <c>true</c> disables link previews for links in this message.
        /// </param>
        /// <param name="disableNotification">If set to <c>true</c> sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.</param>
        /// <param name="replyToMessageId">
        /// If the message is a reply, ID of the original message.
        /// </param>
        /// <param name="replyMarkup">
        /// Additional interface options. An <see cref="IReply" /> object for a custom reply keyboard,
        /// instructions to hide keyboard or to force a reply from the user.
        /// </param>
        /// <param name="cancellationToken">
        /// A cancellation token that can be used by other objects or threads to receive notice of
        /// cancellation.
        /// </param>
        /// <returns>
        /// On success, returns the sent <see cref="Message" />.
        /// </returns>
        public Task<Message> SendMessageAsync([NotNull] string chatId, [NotNull] string text, ParseMode parseMode = ParseMode.Normal, bool disableWebPagePreview = false, bool disableNotification = false, long replyToMessageId = 0, IReply replyMarkup = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            Contracts.EnsureNotNull(chatId, nameof(chatId));
            Contracts.EnsureNotNull(text, nameof(text));

            var parameters = new NameValueCollection { { "text", text } };
            parameters.AddIf(disableWebPagePreview, "disable_web_page_preview", true);
            parameters.AddIf(parseMode != ParseMode.Normal, "parse_mode", parseMode.ToString());

            return this.CallTelegramMethodAsync<Message>(cancellationToken, "sendMessage", parameters, chatId, replyToMessageId, replyMarkup, disableNotification);
        }
开发者ID:mrtaikandi,项目名称:Telebot,代码行数:38,代码来源:Telebot.message.cs


注:本文中的ParseMode.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。