Satori
The Universal Messenger Protocol
Roadmap
- Infrastructure
- <input checked="" disabled="" type="checkbox"> @satorijs/core
- <input checked="" disabled="" type="checkbox"> @satorijs/element
- <input checked="" disabled="" type="checkbox"> @satorijs/satori
- <input checked="" disabled="" type="checkbox"> @satorijs/protocol
- <input checked="" disabled="" type="checkbox"> @satorijs/plugin-server
- Ecosystem
- <input checked="" disabled="" type="checkbox"> DingTalk (钉钉)
- <input checked="" disabled="" type="checkbox"> Discord
- <input checked="" disabled="" type="checkbox"> KOOK (开黑啦)
- <input checked="" disabled="" type="checkbox"> Lark (飞书)
- <input checked="" disabled="" type="checkbox"> Line
- <input checked="" disabled="" type="checkbox"> Mail
- <input checked="" disabled="" type="checkbox"> Matrix
- <input checked="" disabled="" type="checkbox"> QQ Guild
- <input checked="" disabled="" type="checkbox"> Slack
- <input checked="" disabled="" type="checkbox"> Telegram
- <input checked="" disabled="" type="checkbox"> WhatsApp
- <input checked="" disabled="" type="checkbox"> WeCom (企业微信)
- <input checked="" disabled="" type="checkbox"> Wechat Official (微信公众号)
- <input checked="" disabled="" type="checkbox"> Zulip
Examples
Basic usage
import { Context } from '@satorijs/core'
import discord from '@satorijs/adapter-discord'
// create a new context
const ctx = new Context()
// configure a Discord account
ctx.plugin(discord, {
token: 'xxxxxx',
})
// listen to message events
ctx.on('message', (session) => {
console.log(session.content)
})
// start application
await ctx.start()
Specifying protocol
import { Context } from '@satorijs/core'
import router from '@cordisjs/plugin-server'
import telegram from '@satorijs/adapter-telegram'
// your application will be listening http://localhost:8080
// and be available at https://example.com
const ctx = new Context({
port: 8080,
selfUrl: 'https://example.com',
})
// you need a router plugin to handle http requests
ctx.plugin(router)
ctx.plugin(telegram, {
// telegram supports two ways of connection: server and polling
protocol: 'server',
path: '/telegram',
token: 'xxxxxx',
})
Multiple accounts
// specify multiple accounts with different platforms and protocols
ctx.plugin(discord, {
token: 'xxxxxx',
})
ctx.plugin(telegram, {
protocol: 'server',
token: 'yyyyyy',
})
ctx.plugin(telegram, {
protocol: 'polling',
token: 'zzzzzz',
})
Removing an account
Based on cordis.
const fork = ctx.plugin(discord, {
token: 'xxxxxx',
})
fork.dispose()