Class ConversationContextImpl

java.lang.Object
org.teleight.teleightbots.conversation.ConversationContextImpl
All Implemented Interfaces:
ConversationContext

@Internal public class ConversationContextImpl extends Object implements ConversationContext
  • Constructor Details

    • ConversationContextImpl

      protected ConversationContextImpl(@NotNull @NotNull TelegramBot bot, @NotNull @NotNull Chat chat, @NotNull @NotNull User user, @NotNull @NotNull Conversation conversation, @Nullable @Nullable Map<String,Object> properties)
  • Method Details

    • getProperty

      @Nullable public @Nullable Property<?> getProperty(@NotNull @NotNull String name)
      Description copied from interface: ConversationContext
      Gets a property by name.
      Specified by:
      getProperty in interface ConversationContext
      Parameters:
      name - The name of the property.
      Returns:
      The property, or null if the property does not exist.
    • getProperties

      @NotNull public @Unmodifiable @NotNull Map<String, Property<?>> getProperties()
      Specified by:
      getProperties in interface ConversationContext
      Returns:
      A map of all properties applied to the conversation.
    • bot

      @NotNull public @NotNull TelegramBot bot()
      Specified by:
      bot in interface ConversationContext
      Returns:
      The bot associated with this ConversationContext.
    • chat

      @NotNull public @NotNull Chat chat()
      Specified by:
      chat in interface ConversationContext
      Returns:
      The chat associated with this ConversationContext.
    • user

      @NotNull public @NotNull User user()
      Specified by:
      user in interface ConversationContext
      Returns:
      The user associated with this ConversationContext.
    • conversation

      @NotNull public @NotNull Conversation conversation()
      Specified by:
      conversation in interface ConversationContext
      Returns:
      The conversation associated with this ConversationContext.
    • waitForUpdate

      @Nullable public @Nullable Update waitForUpdate()
      Description copied from interface: ConversationContext
      Waits for an update with no timeout. This is not recommended in most cases.
      Specified by:
      waitForUpdate in interface ConversationContext
      Returns:
      The update, or null if no update is received.
    • waitForUpdate

      @Nullable public @Nullable Update waitForUpdate(long timeout, @NotNull @NotNull TimeUnit unit)
      Description copied from interface: ConversationContext
      Waits for an update with a specified timeout.
      Specified by:
      waitForUpdate in interface ConversationContext
      Parameters:
      timeout - The timeout in the specified time unit.
      unit - The time unit of the timeout.
      Returns:
      The update, or null if no update is received within the timeout.
    • runningConversation

      protected ConversationContextImpl.ConversationLifecycle runningConversation()