Trait

com.bot4s.telegram.api.declarative

Declarative

Related Doc: package declarative

Permalink

trait Declarative extends Updates with Messages with ChannelPosts with Callbacks with InlineQueries with Payments

Declarative interface.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Declarative
  2. Payments
  3. InlineQueries
  4. Callbacks
  5. ChannelPosts
  6. Messages
  7. Updates
  8. BotBase
  9. AnyRef
  10. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val client: RequestHandler

    Permalink
    Definition Classes
    BotBase

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def ackCallback(text: Option[String] = None, showAlert: Option[Boolean] = None, url: Option[String] = None, cacheTime: Option[Int] = None)(implicit callbackQuery: CallbackQuery): Future[Boolean]

    Permalink

    Send a response for a callback query.

    Send a response for a callback query. Callback queries must ack-ed e.g. ackCallback(), even if no response is sent.

    text

    Text of the notification. If not specified, nothing will be shown to the user

    showAlert

    If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.

    url

    URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button.

    cacheTime

    The maximum amount of time in seconds that the result of the callback query may be cached client-side. Telegram apps will support caching starting in version 3.14. Defaults to 0.

    returns

    A future containing the result of the AnswerCallbackQuery request.

    Definition Classes
    Callbacks
  5. def allowedUpdates: Option[Seq[UpdateType]]

    Permalink

    Allowed updates.

    Allowed updates. See UpdateType.Filters. By default all updates are allowed.

    returns

    Allowed updates. None indicates no-filtering (all updates allowed).

    import UpdateType.Filters._
    override def allowedUpdates: Option[Seq[UpdateType]] =
      Some(MessageUpdates ++ InlineUpdates)
    Definition Classes
    BotBase
  6. def answerInlineQuery(results: Seq[InlineQueryResult], cacheTime: Option[Int] = None, isPersonal: Option[Boolean] = None, nextOffset: Option[String] = None, switchPmText: Option[String] = None, switchPmParameter: Option[String] = None)(implicit inlineQuery: InlineQuery): Future[Boolean]

    Permalink

    Use this method to send answers to an inline query.

    Use this method to send answers to an inline query. On success, True is returned. No more than 50 results per query are allowed.

    results

    Array of InlineQueryResult A JSON-serialized array of results for the inline query

    cacheTime

    Integer Optional The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.

    isPersonal

    Boolean Optional Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query

    nextOffset

    String Optional Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.

    switchPmText

    String Optional If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switch_pm_parameter

    switchPmParameter

    String Optional Parameter for the start message sent to the bot when user presses the switch buttonExample: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an oauth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.

    Definition Classes
    InlineQueries
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  13. var getMe: User

    Permalink
    Attributes
    protected
    Definition Classes
    BotBase
  14. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  17. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. def onCallbackQuery(action: Action[CallbackQuery]): Unit

    Permalink

    Executes 'action' for every incoming callback query.

    Executes 'action' for every incoming callback query.

    Definition Classes
    Callbacks
  20. def onCallbackWithTag(tag: String)(action: Action[CallbackQuery]): Unit

    Permalink

    Filter callbacks based on a tag (to avoid collision).

    Filter callbacks based on a tag (to avoid collision). The tag is stripped from the CallbackQuery object when passed to the handler.

    tag

    Tag

    action

    Handler to process the filtered callback query.

    Definition Classes
    Callbacks
  21. def onChannelPost(action: Action[Message]): Unit

    Permalink

    Executes action for every channel post.

    Executes action for every channel post.

    Definition Classes
    ChannelPosts
  22. def onChosenInlineResult(action: Action[ChosenInlineResult]): Unit

    Permalink

    Executes 'action' for every inline result.

    Executes 'action' for every inline result. * See https://core.telegram.org/bots/inline#collecting-feedback

    Definition Classes
    InlineQueries
  23. def onEditedChannelPost(action: Action[Message]): Unit

    Permalink

    Executes action for every incoming edited channel post.

    Executes action for every incoming edited channel post.

    Definition Classes
    ChannelPosts
  24. def onEditedMessage(action: Action[Message]): Unit

    Permalink

    Executes action for every incoming edited message event.

    Executes action for every incoming edited message event.

    Definition Classes
    Messages
  25. def onInlineQuery(action: Action[InlineQuery]): Unit

    Permalink

    Executes 'action' for every inline query.

    Executes 'action' for every inline query.

    Definition Classes
    InlineQueries
  26. def onMessage(action: Action[Message]): Unit

    Permalink

    Executes action for every incoming message.

    Executes action for every incoming message.

    Definition Classes
    Messages
  27. def onPreCheckoutQuery(action: Action[PreCheckoutQuery]): Unit

    Permalink

    Executes 'action' for every pre-checkout query.

    Executes 'action' for every pre-checkout query.

    Definition Classes
    Payments
  28. def onShippingQuery(action: Action[ShippingQuery]): Unit

    Permalink

    Executes 'action' for every shipping query.

    Executes 'action' for every shipping query.

    Definition Classes
    Payments
  29. def onUpdate(action: Action[Update]): Unit

    Permalink

    Executes action for every update.

    Executes action for every update.

    Definition Classes
    Updates
  30. def prefixTag(tag: String)(s: String): String

    Permalink

    Helper to tag 'callbackData' in inline markups.

    Helper to tag 'callbackData' in inline markups. Usage:

    def tag = prefixTag("MY_TAG") _
    
    ... callbackData = tag("some data")
    Definition Classes
    Callbacks
  31. def receiveCallbackQuery(callbackQuery: CallbackQuery): Unit

    Permalink
    Definition Classes
    CallbacksBotBase
  32. def receiveChannelPost(msg: Message): Unit

    Permalink
    Definition Classes
    ChannelPostsBotBase
  33. def receiveChosenInlineResult(chosenInlineResult: ChosenInlineResult): Unit

    Permalink
    Definition Classes
    InlineQueriesBotBase
  34. def receiveEditedChannelPost(msg: Message): Unit

    Permalink
    Definition Classes
    ChannelPostsBotBase
  35. def receiveEditedMessage(msg: Message): Unit

    Permalink
    Definition Classes
    MessagesBotBase
  36. def receiveInlineQuery(inlineQuery: InlineQuery): Unit

    Permalink
    Definition Classes
    InlineQueriesBotBase
  37. def receiveMessage(msg: Message): Unit

    Permalink
    Definition Classes
    MessagesBotBase
  38. def receivePreCheckoutQuery(preCheckoutQuery: PreCheckoutQuery): Unit

    Permalink
    Definition Classes
    PaymentsBotBase
  39. def receiveShippingQuery(shippingQuery: ShippingQuery): Unit

    Permalink
    Definition Classes
    PaymentsBotBase
  40. def receiveUpdate(update: Update): Unit

    Permalink

    Dispatch updates to specialized handlers.

    Dispatch updates to specialized handlers. Incoming update can be a message, edited message, channel post, edited channel post, inline query, inline query results (sample), callback query, shipping or pre-checkout events.

    Definition Classes
    UpdatesBotBase
  41. def reply(text: String, parseMode: Option[ParseMode] = None, disableWebPagePreview: Option[Boolean] = None, disableNotification: Option[Boolean] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None)(implicit message: Message): Future[Message]

    Permalink

    Sends text replies.

    Sends text replies. Supports Markdown/HTML formatting and markups.

    Note:

    Only the tags mentioned above are currently supported. Tags must not be nested. All <, > and & symbols that are not a part of a tag or an HTML entity must be replaced with the corresponding HTML entities (< with <, > with > and & with &). All numerical HTML entities are supported. The API currently supports only the following named HTML entities: <, >, & and ".

    text

    Text of the message to be sent

    parseMode

    Optional Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in your bot's message.

    disableWebPagePreview

    Optional Disables link previews for links in this message

    disableNotification

    Optional Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    com.bot4s.telegram.models.InlineKeyboardMarkup or com.bot4s.telegram.models.ReplyKeyboardMarkup or com.bot4s.telegram.models.ReplyKeyboardRemove or com.bot4s.telegram.models.ForceReply Optional Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

    Definition Classes
    Messages
  42. def replyMd(text: String, disableWebPagePreview: Option[Boolean] = None, disableNotification: Option[Boolean] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None)(implicit message: Message): Future[Message]

    Permalink

    Sends text replies in Markdown format.

    Sends text replies in Markdown format.

    text

    Text of the message to be sent

    disableWebPagePreview

    Optional Disables link previews for links in this message

    disableNotification

    Optional Sends the message silently. iOS users will not receive a notification, Android users will receive a notification with no sound.

    replyToMessageId

    Optional If the message is a reply, ID of the original message

    replyMarkup

    models.InlineKeyboardMarkup or models.ReplyKeyboardMarkup or ReplyKeyboardRemove or ForceReply Optional Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to hide reply keyboard or to force a reply from the user.

    Definition Classes
    Messages
  43. def request: RequestHandler

    Permalink
    Definition Classes
    BotBase
  44. def run(): Future[Unit]

    Permalink
    Definition Classes
    BotBase
  45. def shutdown(): Unit

    Permalink
    Definition Classes
    BotBase
  46. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  47. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  48. def using[T](extractor: Extractor[Message, T])(actionT: Action[T])(implicit msg: Message): Unit

    Permalink

    Generic extractor for messages.

    Generic extractor for messages.

    Definition Classes
    Messages
    Example:
    1. onCommand('hello) { implicit msg =>
        using(_.from) {
          user =>
            reply(s"Hello ${user.firstName}!")
        }
      }
  49. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Payments

Inherited from InlineQueries

Inherited from Callbacks

Inherited from ChannelPosts

Inherited from Messages

Inherited from Updates

Inherited from BotBase

Inherited from AnyRef

Inherited from Any

Ungrouped