Skip to content

Instantly share code, notes, and snippets.

@arj03
Created December 1, 2020 09:03
Show Gist options
  • Save arj03/ff2afea64fe87d05a01a5160a9cd6423 to your computer and use it in GitHub Desktop.
Save arj03/ff2afea64fe87d05a01a5160a9cd6423 to your computer and use it in GitHub Desktop.
const tribes = require("ssb-tribes")
const Bot = require("scuttle-testbot")
const Stack = Bot.use(require("ssb-backlinks")).use(tribes)
const bot = Stack()
const Stack2 = Bot.use(require("ssb-backlinks")).use(tribes)
const bot2 = Stack2()
bot.tribes.create({}, (err, data) => {
const groupId = data.groupId
console.log(data) // groupKey
// publishes a msg
bot.tribes.invite(groupId, [bot2.id], {}, (err, msg) => {
console.log("invite", msg)
bot.get({id:msg.key, private: true}, (err, decrypted) => {
console.log(decrypted.content)
})
bot.close()
})
return
bot.publish({type: 'test', content: "a test message", recps: [groupId]}, (err, msg) => {
console.log(msg)
bot.get({id:msg.key, private: true}, (err, decrypted) => {
console.log(decrypted)
})
bot.close()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment