Annotation Interface ChatBoostHandler


@Retention(RUNTIME) @Target(METHOD) @Repeatable(ChatBoostHandlers.class) public @interface ChatBoostHandler
Annotation for handling chat boost events in a declarative manner. Designed specifically for handling events when a chat receives a boost, which can include supergroup upgrades, premium features activation, or other boost-related notifications.

Basic chat boost handler example:


 @ChatBoostHandler
 void handleChatBoost(BotContext context, ChatBoostUpdated boost) {
     // Handle chat boost event

 }
 

Custom filtered boost handler example:


 @ChatBoostHandler(filter = PremiumBoostFilter.class)
 void handlePremiumBoost(BotContext context, ChatBoostUpdated boost) {
     // Handle premium-level chat boosts using custom filtering
 }
 

Multiple boost handlers with priorities:


 @ChatBoostHandler(priority = -10)
 void handleFirstBoost(BotContext context, ChatBoostUpdated boost) {
     // This handler executes first due to lower priority
 }

 @ChatBoostHandler(priority = 0)
 void handleSecondBoost(BotContext context, ChatBoostUpdated boost) {
     // This handler executes second
 }
 
Equivalent with using BotClient.onChatBoost(FilterExecutor, UpdateHandler)
Since:
1.2.0
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Class<? extends CustomFilter>
    Custom filter class for advanced filtering of chat boost events.
    int
    Priority order for handler registration and execution.
  • Element Details

    • filter

      Class<? extends CustomFilter> filter
      Custom filter class for advanced filtering of chat boost events. Use this to implement custom logic for determining which boost events should trigger this handler, such as filtering by boost count, boost level, booster information, or other application-specific criteria.
      Returns:
      class implementing CustomFilter interface
      Default:
      io.github.natanimn.telebof.filters.DefaultCustomFilter.class
    • priority

      int priority
      Priority order for handler registration and execution. Handlers with lower priority numbers are registered and executed before those with higher numbers. This allows controlling the order of handler processing when multiple handlers could match the same chat boost event.
      Returns:
      priority integer value (lower = earlier execution)
      Default:
      0