Class Filter

java.lang.Object
io.github.natanimn.telebof.filters.Filter

public class Filter extends Object
A class for filtering updates
Since:
3 March 2025
  • Constructor Details

    • Filter

      public Filter(Update update, StateMemoryStorage storage)
      Required
      Parameters:
      update - an updated
      storage - state storage.
  • Method Details

    • text

      public Boolean text()
      Filter text messages.
      Returns:
      Boolean
    • Private

      public Boolean Private()
      Filter messages sent in private chats.
      Returns:
      Boolean
    • channel

      public Boolean channel()
      Filter messages sent in channels.
      Returns:
      Boolean
    • supergroup

      public Boolean supergroup()
      Filter messages sent in supergroup chats.
      Returns:
      Boolean
    • group

      public Boolean group()
      Filter messages sent in group chats.
      Returns:
      Boolean
    • photo

      public Boolean photo()
      Filter messages that contain PhotoSize objects.
      Returns:
      Boolean
    • video

      public Boolean video()
      Filter messages that contain Video objects.
      Returns:
      Boolean
    • voice

      public Boolean voice()
      Filter messages that contain Voice objects.
      Returns:
      Boolean
    • document

      public Boolean document()
      Filter messages that contain Document objects.
      Returns:
      Boolean
    • videoNote

      public Boolean videoNote()
      Filter messages that contain VideoNote objects.
      Returns:
      Boolean
    • animation

      public Boolean animation()
      Filter messages that contain Animation objects.
      Returns:
      Boolean
    • contact

      public Boolean contact()
      Filter messages that contain Contact objects.
      Returns:
      Boolean
    • location

      public Boolean location()
      Filter messages that contain Location objects.
      Returns:
      Boolean
    • venue

      public Boolean venue()
      Filter messages that contain Venue objects.
      Returns:
      Boolean
    • game

      public Boolean game()
      Filter messages that contain Game objects.
      Returns:
      Boolean
    • dice

      public Boolean dice()
      Filter messages that contain Dice objects.
      Returns:
      Boolean
    • sticker

      public Boolean sticker()
      Filter messages that contain Sticker objects.
      Returns:
      Boolean
    • audio

      public Boolean audio()
      Filter messages that contain Audio objects.
      Returns:
      Boolean
    • invoice

      public Boolean invoice()
      Filter messages that contain Invoice objects.
      Returns:
      Boolean
    • quote

      public Boolean quote()
      Filter messages that contain TextQuote objects.
      Returns:
      Boolean
    • giveaway

      public Boolean giveaway()
      Filter messages that contain Giveaway objects.
      Returns:
      Boolean
    • media

      public Boolean media()
      Filter media messages.
      A media message contains any of the following fields set: Audio, Document, PhotoSize, Sticker, Video, Animation, Voice, VideoNote.
      Returns:
      Boolean
    • newChatMember

      public Boolean newChatMember()
      Filter service messages for new chat members.
      Returns:
      Boolean
    • leftChatMember

      public Boolean leftChatMember()
      Filter service messages for left chat member.
      Returns:
      Boolean
    • pinnedMessage

      public Boolean pinnedMessage()
      Filter service messages for new pinned message.
      Returns:
      Boolean
    • newChatPhoto

      public Boolean newChatPhoto()
      Filter service messages for new chat phot.
      Returns:
      Boolean
    • newChatTitle

      public Boolean newChatTitle()
      Filter service messages for new chat title.
      Returns:
      Boolean
    • groupCreated

      public Boolean groupCreated()
      Filter service messages for group chat created.
      Returns:
      Boolean
    • supergroupCreated

      public Boolean supergroupCreated()
      Filter service messages for supergroup chat created.
      Returns:
      Boolean
    • channelCreated

      public Boolean channelCreated()
      Filter service messages for channel deleted.
      Returns:
      Boolean
    • messageAutoDeleteTimerChanged

      public Boolean messageAutoDeleteTimerChanged()
      Filter service messages for message auto timer changed.
      Returns:
      Boolean
    • migrated

      public Boolean migrated()
      Filter service messages for migration from group to supergroup and vice versa
      Returns:
      Boolean
    • successfulPayment

      public Boolean successfulPayment()
      Filter service messages for successful payment.
      Returns:
      Boolean
    • proximityAlertTriggered

      public Boolean proximityAlertTriggered()
      Filter service messages for proximity alert triggered.
      Returns:
      Boolean
    • forumTopicCreated

      public Boolean forumTopicCreated()
      Filter service messages for forum topic created.
      Returns:
      Boolean
    • forumTopicEdited

      public Boolean forumTopicEdited()
      Filter service messages for forum topic edited.
      Returns:
      Boolean
    • forumTopicClosed

      public Boolean forumTopicClosed()
      Filter service messages for forum topic closed.
      Returns:
      Boolean
    • forumTopicReopened

      public Boolean forumTopicReopened()
      Filter service messages for forum topic reopened.
      Returns:
      Boolean
    • videoChatStarted

      public Boolean videoChatStarted()
      Filter service messages for video chat started.
      Returns:
      Boolean
    • videoChatScheduled

      public Boolean videoChatScheduled()
      Filter service messages for video chat scheduled.
      Returns:
      Boolean
    • videoChatParticipantInvited

      public Boolean videoChatParticipantInvited()
      Filter service messages for video chat participant invited.
      Returns:
      Boolean
    • videoChatEnded

      public Boolean videoChatEnded()
      Filter service messages for video chat ended.
      Returns:
      Boolean
    • forwarded

      public Boolean forwarded()
      Filter service messages for forwarded messages.
      Returns:
      Boolean
    • replied

      public Boolean replied()
      Filter service messages for replied messages.
      Returns:
      Boolean
    • repliedToStory

      public Boolean repliedToStory()
      Filter service messages for replied to story messages.
      Returns:
      Boolean
    • bot

      public Boolean bot()
      Filter messages coming from bots.
      Returns:
      Boolean
    • giveawayCreated

      public Boolean giveawayCreated()
      Filter service messages for giveaway created.
      Returns:
      Boolean
    • giveawayCompleted

      public Boolean giveawayCompleted()
      Filter service messages for giveaway completed.
      Returns:
      Boolean
    • boostAdded

      public Boolean boostAdded()
      Filter service messages for boost added.
      Returns:
      Boolean
    • usersShared

      public Boolean usersShared()
      Filter service messages for users shared.
      Returns:
      Boolean
    • writeAccessAllowed

      public Boolean writeAccessAllowed()
      Filter service messages for writing access allowed.
      Returns:
      Boolean
    • checklist

      public Boolean checklist()
      Filter messages for containing Checklist
      Returns:
      Boolean
    • checklistTasksDone

      public Boolean checklistTasksDone()
      Filter service messages for checklist tasks done
      Returns:
      Boolean
    • checklistTasksAdded

      public Boolean checklistTasksAdded()
      Filter service messages for checklist tasks added
      Returns:
      Boolean
    • directMessagePriceChanged

      public Boolean directMessagePriceChanged()
      Filter service messages for direct message price changed
      Returns:
      Boolean
    • entities

      public Boolean entities()
      Filter messages for containing MessageEntity.
      Returns:
      Boolean
    • chatBackgroundSet

      public Boolean chatBackgroundSet()
      Filter service messages for gchat background set.
      Returns:
      Boolean
    • chatShared

      public Boolean chatShared()
      Filter service messages for chat shared.
      Returns:
      Boolean
    • emptyQuery

      public Boolean emptyQuery()
      Filter inline query for empty query.
      Returns:
      Boolean
    • webAppData

      public Boolean webAppData()
      Filter messages contain WebAppData.
      Returns:
      Boolean
    • passportData

      public Boolean passportData()
      Filter messages contain PassportData.
      Returns:
      Boolean
    • refundedPayment

      public Boolean refundedPayment()
      Filter service messages for refunded payment.
      Returns:
      Boolean
    • commands

      public boolean commands(String... commands)
      Filter commands
      Parameters:
      commands - The command or array of commands as string
      Returns:
      Boolean
    • callbackData

      public boolean callbackData(String... data)
      Filter callback data of inline button
      Parameters:
      data - The callback data
      Returns:
      Boolean
    • inlineQuery

      public boolean inlineQuery(String... queries)
      Filter query of inline query
      Parameters:
      queries - The query
      Returns:
      Boolean
    • customFilter

      public boolean customFilter(CustomFilter customFilter)
      Creates a custom filter.
      Custom filters give you extra control over which updates are allowed or not to be processed by your handlers.
      Parameters:
      customFilter - The custom filter
      Returns:
      Boolean
    • state

      public boolean state(String name)
      Filters state
      Parameters:
      name - state name
      Returns:
      Boolean
    • texts

      public boolean texts(String... texts)
      Filter messages containing a given texts
      Parameters:
      texts - The text
      Returns:
      Boolean
    • regex

      public boolean regex(String pattern)
      Filter updates that match a given regular expression pattern.
      Parameters:
      pattern - regex pattern
      Returns:
      Boolean
    • chatIds

      public boolean chatIds(Long... ids)
      Filter updates that match a chat id.
      Parameters:
      ids - chat ids
      Returns:
      Boolean
    • fromIds

      public boolean fromIds(Long... ids)
      Filter updates that match a user id.
      Parameters:
      ids - user ids
      Returns:
      Boolean
    • chatUsernames

      public boolean chatUsernames(String... usernames)
      Filter updates that match a given chat username.
      Parameters:
      usernames - The username
      Returns:
      Boolean
    • usernames

      public boolean usernames(String... usernames)
      Filter updates that match a given user's username.
      Parameters:
      usernames - The username
      Returns:
      Boolean
    • reaction

      public boolean reaction(String react)
      Filter reactions that match a given reaction.
      Parameters:
      react - reactions
      Returns:
      Boolean