nostr-tribes
Version:
Client library for using nostr tribes
37 lines (27 loc) • 1.67 kB
Markdown
# Nostr Tribes
Typescript library to work with Nostr tribes in the browser and in nodejs.
Learn more about tribes at https://tribewiki.org/Tribe or browse tribes at https://nostribe.org
## Usage
Basic usage:
```
let tribe = new Tribe("32149:leader-pubkey:tribeid"", {relays}) // or new Tribe("naddr1...")
await tribe.sync() // Fetch members
await tribe.sync_profiles() // Fetch member profiles (name, avatar, nip05)
tribe.subscribe() // Subscribe for changes in tribe membership
tribe.member(pubkey) // returns true if pubkey is a member
tribe.entry(pubkey) // returns all known info on member (name, nip05, avatar, parent)
some_events = ... // Fetch nostr events from a relay
let judgements = await tribe.judgeEvents(some_events) // Decide which events are approved by the tribe
// Returns {[event_id]: [verdict, object, stamp]}
// verdict is either 'curate', 'neutral' or 'ban'
// object is either 'pubkey' or 'event'
// if object is 'event', the corresponding kind:78 stamp is returned as the 3rd item in the list
await tribe.stamp_event(some_event) // Curate an event (stamp it) and upload the stamp to tribe relays.
await tribe.stamp_pubkey(some_event.pubkey) // Add a new member to the tribe, store stamp on tribe relays.
```
## Roadmap
* Ban should have effect only on parent's sub-tree
* Maintain parents[] instead of a single parent for each member
* Pass log_fn in constructor for logging. If not passed, do not log.
* Add a way to maintain permissions for members. These perms can be queried by clients, or have effect on core mechanics of tribes. E.g. moderator perm.
* Invitations (possibly through an online bot that keeps invite tree private)