Record Class LongPollingBotSettings

java.lang.Object
java.lang.Record
org.teleight.teleightbots.bot.settings.LongPollingBotSettings
Record Components:
endpointUrl - The endpoint URL to be used for connecting with the Telegram Bot API.
updatesLimit - The maximum number of updates that the bot will fetch in a single API call.
updatesTimeout - The timeout, in seconds, for fetching updates from the Telegram API. This is the maximum time the server will wait for a response before timing out.
silentlyThrowMethodExecution - Whether to silently throw method execution errors.
extensionsEnabled - Whether bot extensions are enabled.
allowedUpdates - A list of update types that the bot is allowed to receive. If null or empty, the bot will receive all update types except "chat_member", "message_reaction", and "message_reaction_count"
All Implemented Interfaces:
BotSettings

public record LongPollingBotSettings(String endpointUrl, int updatesLimit, int updatesTimeout, boolean silentlyThrowMethodExecution, boolean extensionsEnabled, List<String> allowedUpdates) extends Record implements BotSettings
Represents the settings for configuring a long polling Telegram bot.

Example usage:


 LongPollingBotSettings settings = LongPollingBotSettings.ofBuilder()
         .endpointUrl("https://custom.api.url/bot")
         .updatesLimit(100)
         .updatesTimeout(300)
         .silentlyThrowMethodExecution(true)
         .extensionsEnabled(true)
         .build();
 
  • Field Details

    • DEFAULT

      public static final LongPollingBotSettings DEFAULT
      Default instance of BotSettings with standard configurations
  • Constructor Details

    • LongPollingBotSettings

      public LongPollingBotSettings(String endpointUrl, int updatesLimit, int updatesTimeout, boolean silentlyThrowMethodExecution, boolean extensionsEnabled, List<String> allowedUpdates)
      Creates an instance of a LongPollingBotSettings record class.
      Parameters:
      endpointUrl - the value for the endpointUrl record component
      updatesLimit - the value for the updatesLimit record component
      updatesTimeout - the value for the updatesTimeout record component
      silentlyThrowMethodExecution - the value for the silentlyThrowMethodExecution record component
      extensionsEnabled - the value for the extensionsEnabled record component
      allowedUpdates - the value for the allowedUpdates record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • endpointUrl

      public String endpointUrl()
      Returns the value of the endpointUrl record component.
      Specified by:
      endpointUrl in interface BotSettings
      Returns:
      the value of the endpointUrl record component
    • updatesLimit

      public int updatesLimit()
      Returns the value of the updatesLimit record component.
      Returns:
      the value of the updatesLimit record component
    • updatesTimeout

      public int updatesTimeout()
      Returns the value of the updatesTimeout record component.
      Returns:
      the value of the updatesTimeout record component
    • silentlyThrowMethodExecution

      public boolean silentlyThrowMethodExecution()
      Returns the value of the silentlyThrowMethodExecution record component.
      Specified by:
      silentlyThrowMethodExecution in interface BotSettings
      Returns:
      the value of the silentlyThrowMethodExecution record component
    • extensionsEnabled

      public boolean extensionsEnabled()
      Returns the value of the extensionsEnabled record component.
      Specified by:
      extensionsEnabled in interface BotSettings
      Returns:
      the value of the extensionsEnabled record component
    • allowedUpdates

      public List<String> allowedUpdates()
      Returns the value of the allowedUpdates record component.
      Returns:
      the value of the allowedUpdates record component