Skip to content

Use dotty context functions for cleaner command handlers #95

@XDracam

Description

@XDracam

Obviously, this feature requires dotty.

By using Context Functions we can get rid of the implicit msg => that litters many a bot.

This example works in a dotty project:

  type MsgHandler = Message ?=> Future[Unit]
  def onCmd(filter: CommandFilterMagnet)(action: MsgHandler) = onCommand(filter)(implicit msg => action)

  onCmd("foo") { reply("bar").void }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions