Trait

com.bot4s.telegram.api.declarative

Commands

Related Doc: package declarative

Permalink

trait Commands[F[_]] extends Messages[F] with CommandImplicits

Provides a declarative interface to define commands.

Self Type
Commands[F] with BotBase[F]
Linear Supertypes
CommandImplicits, Messages[F], BotBase[F], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Commands
  2. CommandImplicits
  3. Messages
  4. BotBase
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract val client: RequestHandler[F]

    Permalink
    Definition Classes
    BotBase
  2. implicit abstract val monad: MonadError[F, Throwable]

    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 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
  5. final def asInstanceOf[T0]: T0

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

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def command(msg: Message): Option[Command]

    Permalink

    Extracts the leading /command.

  8. def commandArguments(msg: Message): Option[Args]

    Permalink

    Tokenize message text; drops first token (/command).

  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. def hashCode(): Int

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

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

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

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

    Permalink
    Definition Classes
    AnyRef
  18. def onCommand(filter: Filter[Command])(action: Action[F, Message]): Unit

    Permalink

    Receives /commands with the specified action.

    Receives /commands with the specified action. Commands '/' prefix is optional. "cmd" == "/cmd" == 'cmd Implicits are provided for "string" and 'symbol.

    Example:
    1. onCommand(_.cmd.equalsIgnoreCase("hello")) { implicit msg => ... }
  19. def onCommand(filter: CommandFilterMagnet)(action: Action[F, Message]): Unit

    Permalink

    Receives /commands with the specified action.

    Receives /commands with the specified action. Commands '/' prefix is optional. "cmd" == "/cmd" == 'cmd Purely syntax honey for command filters.

    Example:
    1. onCommand("/command") { implicit msg => ... }
      onCommand("command") { implicit msg => ... }
      onCommand('echo) { implicit msg => ... }
      onCommand('hi | 'hello | 'hey) { implicit msg => ... }
      onCommand("/adieu" | "/bye") { implicit msg => ... }
  20. def onEditedMessage(action: Action[F, Message]): Unit

    Permalink

    Executes action for every incoming edited message event.

    Executes action for every incoming edited message event.

    Definition Classes
    Messages
  21. def onExtMessage(action: Action[F, (Message, Option[User])]): Unit

    Permalink
    Definition Classes
    Messages
  22. def onMessage(action: Action[F, Message]): Unit

    Permalink

    Executes action for every incoming message.

    Executes action for every incoming message.

    Definition Classes
    Messages
  23. def receiveCallbackQuery(callbackQuery: CallbackQuery): F[Unit]

    Permalink
    Definition Classes
    BotBase
  24. def receiveChannelPost(message: Message): F[Unit]

    Permalink
    Definition Classes
    BotBase
  25. def receiveChosenInlineResult(chosenInlineResult: ChosenInlineResult): F[Unit]

    Permalink
    Definition Classes
    BotBase
  26. def receiveEditedChannelPost(message: Message): F[Unit]

    Permalink
    Definition Classes
    BotBase
  27. def receiveEditedMessage(msg: Message): F[Unit]

    Permalink
    Definition Classes
    MessagesBotBase
  28. def receiveExtMessage(extMessage: (Message, Option[User])): F[Unit]

    Permalink
    Definition Classes
    MessagesBotBase
  29. def receiveInlineQuery(inlineQuery: InlineQuery): F[Unit]

    Permalink
    Definition Classes
    BotBase
  30. def receiveMessage(msg: Message): F[Unit]

    Permalink
    Definition Classes
    MessagesBotBase
  31. def receivePreCheckoutQuery(preCheckoutQuery: PreCheckoutQuery): F[Unit]

    Permalink
    Definition Classes
    BotBase
  32. def receiveShippingQuery(shippingQuery: ShippingQuery): F[Unit]

    Permalink
    Definition Classes
    BotBase
  33. def receiveUpdate(u: Update, botUser: Option[User]): F[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.

    u

    Incoming update.

    Definition Classes
    BotBase
  34. 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): F[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
  35. def replyMd(text: String, disableWebPagePreview: Option[Boolean] = None, disableNotification: Option[Boolean] = None, replyToMessageId: Option[Int] = None, replyMarkup: Option[ReplyMarkup] = None)(implicit message: Message): F[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
  36. def request: RequestHandler[F]

    Permalink
    Definition Classes
    BotBase
  37. def run(): F[Unit]

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

    Permalink
    Definition Classes
    BotBase
  39. implicit def stringToCommandFilter(s: String): CommandFilterMagnet

    Permalink
    Definition Classes
    CommandImplicits
  40. implicit def symbolToCommandFilter(s: Symbol): CommandFilterMagnet

    Permalink
    Definition Classes
    CommandImplicits
  41. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  42. def textTokens(msg: Message): Option[Args]

    Permalink

    Tokenize message text.

  43. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  44. lazy val unit: F[Unit]

    Permalink
    Attributes
    protected
    Definition Classes
    BotBase
  45. def using[T](extractor: Extractor[Message, T])(actionT: Action[F, T])(implicit msg: Message): F[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}!")
        }
      }
  46. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  49. def withArgs(action: Action[F, Args])(implicit msg: Message): F[Unit]

    Permalink

    Extract command arguments from the message's text; if present.

    Extract command arguments from the message's text; if present. The first token, the /command, is dropped.

    Example:
    1. on('echo) { implicit msg =>
        withArgs { args =>
          reply(args.mkString(" "))
        }
      }

Inherited from CommandImplicits

Inherited from Messages[F]

Inherited from BotBase[F]

Inherited from AnyRef

Inherited from Any

Ungrouped