Example #1
0
        public static Message SendPoll(this BotClient api, long chatId, string question, IEnumerable <string> options, [Optional] bool?isAnonymous, [Optional] string?type, [Optional] bool?allowsMultipleAnswers, [Optional] uint?correctOptionId, [Optional] string?explanation, [Optional] string?explanationParseMode, [Optional] IEnumerable <MessageEntity>?explanationEntities, [Optional] ushort?openPeriod, [Optional] uint?closeDate, [Optional] bool?isClosed, [Optional] bool?disableNotification, [Optional] bool?protectContent, [Optional] int?replyToMessageId, [Optional] bool?allowSendingWithoutReply, [Optional] ReplyMarkup?replyMarkup)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new SendPollArgs(chatId, question, options)
            {
                IsAnonymous              = isAnonymous,
                Type                     = type,
                AllowsMultipleAnswers    = allowsMultipleAnswers,
                CorrectOptionId          = correctOptionId,
                Explanation              = explanation,
                ExplanationParseMode     = explanationParseMode,
                ExplanationEntities      = explanationEntities,
                OpenPeriod               = openPeriod,
                CloseDate                = closeDate,
                IsClosed                 = isClosed,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

            return(api.RPC <Message>(MethodNames.SendPoll, args));
        }
Example #2
0
        public static async Task <Message> SendPollAsync(this BotClient bot, SendPollArgs args, [Optional] CancellationToken cancellationToken)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            if (args == default)
            {
                throw new ArgumentNullException(nameof(args));
            }

            return(await bot.RPCA <Message>(MethodNames.SendPoll, args, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Example #3
0
        public static Message SendPoll(this BotClient bot, SendPollArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            if (args == default)
            {
                throw new ArgumentNullException(nameof(args));
            }

            return(bot.RPC <Message>(MethodNames.SendPoll, args));
        }