Ejemplo n.º 1
0
        public async void WriteUser(string command, Moderator user)
        {
            var client = new SlackAPI.SlackTaskClient(Config.SlackToken);

            if (!client.ConnectAsync().Result.ok)
            {
                return;
            }

            string userId = "";

            foreach (var x in client.UserLookup)
            {
                if (String.Equals(x.Value.name, user.Name, StringComparison.InvariantCultureIgnoreCase))
                {
                    userId = x.Value.id;
                    break;
                }
            }

            var channel = await client.JoinDirectMessageChannelAsync(userId);

            var result = await client.PostMessageAsync(channel.channel.id, command, "Consensusbot");

            if (result.ok)
            {
                return;
            }
            else
            {
                Console.Write("something went wrong");
            }
        }
Ejemplo n.º 2
0
      public async void WriteUser(string command, Moderator user)
      {
         var client = new SlackAPI.SlackTaskClient(Config.SlackToken);
         if (!client.ConnectAsync().Result.ok)
         {
            return;
         }

         string userId = "";

         foreach (var x in client.UserLookup)
         {
            if (String.Equals(x.Value.name, user.Name, StringComparison.InvariantCultureIgnoreCase))
            {
               userId = x.Value.id;
               break;
            }
         }

         var channel = await client.JoinDirectMessageChannelAsync(userId);

         var result = await client.PostMessageAsync(channel.channel.id, command, "Consensusbot");
         if (result.ok)
         {
            return;
         }
         else
         {
            Console.Write("something went wrong");
         }
      }
Ejemplo n.º 3
0
        private async Task <SlackAPI.UserListResponse> GetSlackUserData()
        {
            var client = new SlackAPI.SlackTaskClient(Config.SlackToken);

            return(await client.GetUserListAsync());
        }
Ejemplo n.º 4
0
      private async Task<SlackAPI.UserListResponse> GetSlackUserData()
      {
         var client = new SlackAPI.SlackTaskClient(Config.SlackToken);

         return await client.GetUserListAsync();
      }
Ejemplo n.º 5
0
 public SlackService(IConfiguration configuration, IMapper mapper)
 {
     _configuration = configuration;
     _slackClient   = new SlackAPI.SlackTaskClient(GetSlackToken());
     _mapper        = mapper;
 }