Skip to content

wechaty/scala-wechaty-getting-started

Folders and files

NameName
Last commit message
Last commit date

Latest commit

0a5f246 · Jun 6, 2020

History

7 Commits
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 2, 2020
Jun 6, 2020
Jun 2, 2020

Repository files navigation

scala-wechaty-getting-started

Scala Wechaty

Gitpod Ready-to-Code Wechaty in Scala

Scala Wechaty Starter Project Template that Works Out-of-the-Box

Connecting Chatbots

Powered by Wechaty

Wechaty is a RPA SDK for Wechat Individual Account that can help you create a chatbot in 6 lines of Scala.

Requirements

  1. Scala

Quick Start

  1. Clone scala-wechaty-getting-started repository

    git clone https://github.com/wechaty/scala-wechaty-getting-started
    cd scala-wechaty-getting-started
  2. Install Dependencies

    make install
  3. Set token for your bot

    # it must be hostie token
    export WECHATY_PUPPET=wechaty-puppet-hostie
    export WECHATY_PUPPET_HOSTIE_TOKEN=your_token_at_here
  4. Run the bot

    make bot
    # or
    scala examples/ding-dong-bot.scala

The World's Shortest Scala ChatBot: 6 lines of Code

package wechaty

object DingDongBot {
  def main(args: Array[String]): Unit = {
    Wechaty.instance()
      .onScan(payload     => { println("Scan QR Code to login: %s\nhttps://api.qrserver.com/v1/create-qr-code/?data=%s\n".format(payload.status, payload.qrcode)) })
      .onLogin(payload    => { println("User %s logined\n".format(payload.id)) })
      .onMessage(message  => { println(message) })
      .start()
    Thread.currentThread().join()
  }
}

Wechaty Getting Started in Multiple Languages

Badge

Wechaty in Scala

[![Wechaty in Scala](https://img.shields.io/badge/Wechaty-Scala-890)](https://github.com/wechaty/scala-wechaty)

Maintainers

@wechaty/scala

Copyright & License

  • Code & Docs © 2020 Wechaty Contributors https://github.com/wechaty
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

Releases

No releases published

Packages

No packages published