Example #1
0
        public async Task SendLocationMessageAsyncTest()
        {
            var result = await _viberBotClient.SendLocationMessageAsync(new LocationMessage
            {
                Receiver = _adminId,
                Sender   = new UserBase
                {
                    Name = "Smbdy"
                },
                Location = new Location
                {
                    Lon = 1,
                    Lat = -2
                }
            });

            return;
        }
        public async Task SendLocationMessageAsync(int botId, string receiverId, OutMessage message)
        {
            //
            if (message.Location == null)
            {
                throw new ArgumentNullException("location");
            }

            //
            var locationMessage = new LocationMessage
            {
                Receiver      = receiverId,
                MinApiVersion = 4,
                Location      = new Viber.Bot.Models.Location
                {
                    Lat = message.Location.Latitude,
                    Lon = message.Location.Lontitude
                }
            };

            await viberBotClient.SendLocationMessageAsync(locationMessage);
        }