Exemplo n.º 1
0
        public async Task CreateGroupByNumber(string serivePhoneNumber, string clientPhoneNumber, string groupName)
        {
            var serviceContact = await _telegramSession.GetContactForNumber(serivePhoneNumber);

            var clientContact = await _telegramSession.GetContactForNumber(clientPhoneNumber);

            await _telegramSession.CreateGroup(serviceContact, clientContact, groupName);
        }
Exemplo n.º 2
0
        public async Task CreateGroupByNumber(string supportPhoneNumber, string clientPhoneNumber, string groupName)
        {
            var supportContact = await _telegramSession.GetContactForNumber(supportPhoneNumber);

            if (supportContact == null)
            {
                throw new TelegramCreateGroupException("Invalid Support Contact");
            }

            var clientContact = await _telegramSession.GetContactForNumber(clientPhoneNumber);

            if (clientContact == null)
            {
                throw new TelegramCreateGroupException("Invalid Client Contact");
            }

            if (clientContact == supportContact)
            {
                throw new TelegramCreateGroupException("Client and Support Contacts must be different");
            }

            await _telegramSession.CreateGroup(supportContact, clientContact, groupName);
        }
Exemplo n.º 3
0
 public async Task <TelegramContact> GetContactForNumber(string phoneNumber)
 {
     _logger.LogInformation("ConnectionId = {ConnectionId}", HttpContext.Connection.Id);
     return(await _telegramSession.GetContactForNumber(phoneNumber));
 }