public static async Task <OpenedConversationResponse> OpenConversationAsync(SlackClient slackClient, string userId)
        {
            var openedConversationResponse = await slackClient.Conversations.OpenAsync(userId, true);

            await ChatClientMethods.SendSimpleMessageAsync(slackClient, openedConversationResponse.Channel.Id, nameof(OpenConversationAsync));

            return(openedConversationResponse);
        }
        public static async Task <ConversationsHistoryResponse> GetConversationsHistoryAsync(SlackClient slackClient, string channelName)
        {
            var channelId = await GetChannelIdAsync(slackClient, channelName);

            await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelId, nameof(GetConversationsHistoryAsync));

            return(await slackClient.Conversations.HistoryAsync(channelId, 1000));
        }
예제 #3
0
        private static async Task <(SlackBaseResponse PinResponse, SendMessageResponse SendMessageResponse)> PinMessageInternalAsync(
            SlackClient slackClient,
            string channelName)
        {
            var sendMessageResponse = await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelName, nameof(PinMessageInternalAsync));

            var pinItem            = new PinItem(sendMessageResponse.ChannelId, sendMessageResponse.Timestamp);
            var pinMessageResponse = await slackClient.Pins.PinAsync(pinItem);

            return(pinMessageResponse, sendMessageResponse);
        }
예제 #4
0
        private static async Task <(SlackBaseResponse AddReactionResponse, SendMessageResponse SendMessageResponse)> AddReactionInternalAsync(
            SlackClient slackClient,
            string channelName,
            string emojiName = "+1")
        {
            var sendMessageResponse = await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelName, nameof(AddReactionAsync));

            var addReactionResponse = await AddReactionToMessageAsync(slackClient, sendMessageResponse, emojiName);

            return(addReactionResponse, sendMessageResponse);
        }
        public static async Task <ConversationRepliesResponse> GetConversationRepliesAsync(SlackClient slackClient, string channelName)
        {
            var channelId = await GetChannelIdAsync(slackClient, channelName);

            var parentMessage = await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelId, nameof(GetConversationRepliesAsync));

            var parentMessageTimestamp = parentMessage.Timestamp;
            await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelId, nameof(GetConversationRepliesAsync), parentMessageTimestamp);

            await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelId, nameof(GetConversationRepliesAsync), parentMessageTimestamp);

            return(await slackClient.Conversations.RepliesAsync(channelId, parentMessageTimestamp));
        }
예제 #6
0
        public static async Task <BotInfoResponse> GetBotInfoAsync(SlackClient slackClient, string channelName)
        {
            var sendMessageResponse = await ChatClientMethods.SendSimpleMessageAsync(slackClient, channelName, nameof(GetBotInfoAsync));

            return(await slackClient.Bots.InfoAsync(sendMessageResponse.Message.BotId));
        }