Skip to content

sahilyadav-here/lotion-chat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lotion-haiku

collaborative haiku-writing app on a blockchain. built on Lotion.

npm install -g lotion-haiku

# to join an existing chat:
haiku -j <chat id> -p <initial peers>

look how simple the blockchain logic is:

let syllables = require('syllables')

let haikuHandler = (state, tx) => {
  if (
    typeof tx.sender === 'string' &&
    typeof tx.message === 'string' &&
    tx.message.length <= 50
  ) {
    let requiredSyllables = state.messages.length % 3 === 1 ? 7 : 5
    if (syllables(tx.message) === requiredSyllables) {
      state.messages.push({
        sender: tx.sender,
        message: tx.message
      })
    }
  }
}

lotion(haikuHandler)

About

simple lotion chat demo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%