Beispiel #1
0
        public static Message SendContact(this BotClient bot, SendContactArgs args)
        {
            if (bot == default)
            {
                throw new ArgumentNullException(nameof(bot));
            }

            return(bot.RPC <Message>(MethodNames.SendContact, args));
        }
Beispiel #2
0
        public static async Task <Message> SendContactAsync(this BotClient bot, SendContactArgs 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.SendContact, args, cancellationToken : cancellationToken).ConfigureAwait(false));
        }
Beispiel #3
0
        public static Message SendContact(this BotClient api, long chatId, string phoneNumber, string firstName, [Optional] string?lastName, [Optional] string?vcard, [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 SendContactArgs(chatId, phoneNumber, firstName)
            {
                LastName                 = lastName,
                Vcard                    = vcard,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

            return(api.RPC <Message>(MethodNames.SendContact, args));
        }
Beispiel #4
0
        public static async Task <Message> SendContactAsync(this BotClient api, string chatId, string phoneNumber, string firstName, [Optional] string?lastName, [Optional] string?vcard, [Optional] bool?disableNotification, [Optional] bool?protectContent, [Optional] int?replyToMessageId, [Optional] bool?allowSendingWithoutReply, [Optional] ReplyMarkup?replyMarkup, [Optional] CancellationToken cancellationToken)
        {
            if (api == null)
            {
                throw new ArgumentNullException(nameof(api));
            }
            var args = new SendContactArgs(chatId, phoneNumber, firstName)
            {
                LastName                 = lastName,
                Vcard                    = vcard,
                DisableNotification      = disableNotification,
                ProtectContent           = protectContent,
                ReplyToMessageId         = replyToMessageId,
                AllowSendingWithoutReply = allowSendingWithoutReply,
                ReplyMarkup              = replyMarkup
            };

            return(await api.RPCA <Message>(MethodNames.SendContact, args, cancellationToken).ConfigureAwait(false));
        }