Skip to content

Use dotty context functions for cleaner command handlers #95

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 }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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