status-web/packages/status-js/.scripts/example copy 2.ts

24 lines
829 B
TypeScript
Raw Normal View History

2022-05-26 21:17:10 +00:00
import { createClient } from '../src/client'
2022-05-25 12:52:48 +00:00
2022-05-26 21:17:10 +00:00
const COMMUNITY_PUBLIC_KEY =
2022-06-04 11:09:49 +00:00
'0x029f196bbfef4fa6a5eb81dd802133a63498325445ca1af1d154b1bb4542955133' // Boring community
// '0x0243611cc13cc4e4390180fe8fd35234ab0fe2a7ba8d32e8ae5dd23b60ac7ec177'
// '0x02e7102c85ed78e5be30124f8f52014b1135f972c383f55f83ec8ff50436cd1260'
const CHANNEL_ID = '00d3f525-a0cf-4c40-832d-543ec9f8188b' // messages
2022-05-25 12:52:48 +00:00
;(async () => {
2022-06-04 11:09:49 +00:00
const client = await createClient(COMMUNITY_PUBLIC_KEY)
2022-05-25 12:52:48 +00:00
2022-06-04 11:09:49 +00:00
await client.start()
2022-05-25 12:52:48 +00:00
2022-06-04 11:09:49 +00:00
// const community = await client.community.fetchCommunity()
2022-05-29 21:06:18 +00:00
2022-06-04 11:09:49 +00:00
// client.community.onCommunityUpdate(() => console.log("community:update"))
// client.community.onChannelUpdate(() => console.log("channel:update"))
client.community.onChannelMessages(CHANNEL_ID, () =>
console.log('channel:message')
)
2022-05-25 12:52:48 +00:00
2022-06-04 11:09:49 +00:00
// await client.stop()
2022-05-25 12:52:48 +00:00
})()