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 Summary
FieldsModifier and TypeFieldDescriptionstatic final LongPollingBotSettingsDefault instance of BotSettings with standard configurationsFields inherited from interface org.teleight.teleightbots.bot.settings.BotSettings
DEFAULT_BOT_API_URL -
Constructor Summary
ConstructorsConstructorDescriptionLongPollingBotSettings(String endpointUrl, int updatesLimit, int updatesTimeout, boolean silentlyThrowMethodExecution, boolean extensionsEnabled, List<String> allowedUpdates) Creates an instance of aLongPollingBotSettingsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theallowedUpdatesrecord component.Returns the value of theendpointUrlrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theextensionsEnabledrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of thesilentlyThrowMethodExecutionrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of theupdatesLimitrecord component.intReturns the value of theupdatesTimeoutrecord component.
-
Field Details
-
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 aLongPollingBotSettingsrecord class.- Parameters:
endpointUrl- the value for theendpointUrlrecord componentupdatesLimit- the value for theupdatesLimitrecord componentupdatesTimeout- the value for theupdatesTimeoutrecord componentsilentlyThrowMethodExecution- the value for thesilentlyThrowMethodExecutionrecord componentextensionsEnabled- the value for theextensionsEnabledrecord componentallowedUpdates- the value for theallowedUpdatesrecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
endpointUrl
Returns the value of theendpointUrlrecord component.- Specified by:
endpointUrlin interfaceBotSettings- Returns:
- the value of the
endpointUrlrecord component
-
updatesLimit
public int updatesLimit()Returns the value of theupdatesLimitrecord component.- Returns:
- the value of the
updatesLimitrecord component
-
updatesTimeout
public int updatesTimeout()Returns the value of theupdatesTimeoutrecord component.- Returns:
- the value of the
updatesTimeoutrecord component
-
silentlyThrowMethodExecution
public boolean silentlyThrowMethodExecution()Returns the value of thesilentlyThrowMethodExecutionrecord component.- Specified by:
silentlyThrowMethodExecutionin interfaceBotSettings- Returns:
- the value of the
silentlyThrowMethodExecutionrecord component
-
extensionsEnabled
public boolean extensionsEnabled()Returns the value of theextensionsEnabledrecord component.- Specified by:
extensionsEnabledin interfaceBotSettings- Returns:
- the value of the
extensionsEnabledrecord component
-
allowedUpdates
Returns the value of theallowedUpdatesrecord component.- Returns:
- the value of the
allowedUpdatesrecord component
-