Class DefaultChatSender

    • Constructor Detail

      • DefaultChatSender

        public DefaultChatSender​(PlatformUser user,
                                 Chat chat)
    • Method Detail

      • getPlatformUser

        public PlatformUser getPlatformUser()
        Description copied from interface: ChatSender
        Gets the platform user that is associated with this chat sender.
        Specified by:
        getPlatformUser in interface ChatSender
        Returns:
        PlatformUser instance.
      • getChat

        public Chat getChat()
        Description copied from interface: ChatSender
        Gets the chat the message was sent in.
        Specified by:
        getChat in interface ChatSender
        Returns:
        Chat instance.
      • sendList

        public <T> java.util.Collection<ChatMessage> sendList​(java.lang.Class<T> type,
                                                              java.util.function.Consumer<CommandListResponse.Builder<T>> function)
                                                       throws CommandExecutionException
        Description copied from interface: ChatSender
        Creates a list response to get to the command sender, opportunistically formatting as rich content.
        Specified by:
        sendList in interface ChatSender
        Type Parameters:
        T - List item type.
        function - Function providing a command response object from a builder.
        Returns:
        CommandResponse object corresponding to the desired message; contains get() method to dispatch.
        Throws:
        CommandExecutionException
      • sendDetails

        public java.util.Collection<ChatMessage> sendDetails​(java.util.function.Consumer<CommandDetailsResponse.Builder> consumer)
                                                      throws CommandExecutionException
        Description copied from interface: ChatSender
        Creates a details response to get to the command sender, opportunistically formatting as rich content. Details are formatted as such: ObjectName "ObjectKey" details: Key: value Key: [value1,value2,value3]
        Specified by:
        sendDetails in interface ChatSender
        Parameters:
        consumer - Function providing a command response object from a builder.
        Returns:
        CommandResponse object corresponding to the desired message; contains get() method to dispatch.
        Throws:
        CommandExecutionException
      • begin

        public boolean begin()
        Opens the command buffer.
        Specified by:
        begin in interface ChatSender
        Returns:
        true if the buffer was opened, false if no changes were made.
      • canSendEmbeds

        public boolean canSendEmbeds()
        Description copied from interface: ChatMessageReceiver
        Finds if this receiver can send receive embedded messages in this conversation.
        Specified by:
        canSendEmbeds in interface ChatMessageReceiver
        Returns:
        true if the bot can send embedded messages to this receiver, false otherwise.
      • end

        public java.util.Collection<ChatMessage> end()
        Ends the command buffer.
        Specified by:
        end in interface ChatSender
        Returns:
        number of flushes accomplished.
      • flush

        public java.util.Collection<ChatMessage> flush()
        Flushes the buffer.
        Specified by:
        flush in interface ChatSender
        Returns:
        ChatMessage generated.