Comments (6)
I think that having plugins be spawned as children and passing messages across the child's stdin/stdout is the simplest way to do it. Example session:
< { 'action': 'register_cmd', 'name': 'hello', 'usage': 'hello <world>', 'args': [] }
> { 'event: 'command', 'invoker': { 'name': 'John Doe', 'id': '314159' }, 'args': [] }
# processes event
< { 'action': 'send_msg', 'to': '314159', 'text': 'Hello, World!' }
actions:
- register_cmd
- register_listener
- send_msg
- set_nick
- set_color
- set_pronouns
- get_nick
- get_color
- get_pronouns
events:
- msg
- join
- kick
from devzat.
For reference here's the API design idea I came up with on the slack. It's missing some important things but it covers most of the core features (like events and middleware):
Actions
register_cmd(name: string)
send_message(from?: string, ephemeral?: bool)
send_image(src_type: "file" | "url" | "b64", src: string)
register_listener(event: "send" | "something else?", middleware?: bool, once?: bool)
mw_edit_message(text?: string)
mw_done()
Messages
event(name: string, data?: object)
cmd(name: string, args: string)
The actual data format would look something like
{
type: string,
args: object
}
You could also batch actions in a single communication by putting them in an array
If middleware is enabled for an event listener the server will not proceed with sending the message until mw_done is called, and once just makes the listener only fire for the next event (useful for bots)
from devzat.
@quackduck I've heard gRPC is good for efficient inter-process communication but I have no idea how practical it is/how easy it is to integrate with plugins
from devzat.
IIRC you wanted this to use gRPC, right?
from devzat.
It also might be a good idea to consider versioning the API, so plugins can detect breaking changes
from devzat.
๐ current solution: 3025512
(Thanks Benjamin!)
from devzat.
Related Issues (20)
- Support a Matrix Bridge HOT 4
- Keep connection alive HOT 9
- Support for stdin? HOT 7
- got banned lol HOT 2
- It freaks out on me when I use kitty terminal HOT 5
- Better input system HOT 11
- Fix line counting algo HOT 2
- Kick yourself HOT 1
- Single line break HOT 5
- Add pfp depending on the user colours to slack HOT 4
- Changing behavior of `cd` HOT 2
- Crash caught when formting markdown link HOT 6
- May we have different languages supported๏ผ HOT 4
- Few Question in using devzat HOT 1
- Add Mute/Unmute Commands to Devzat
- PSA: HOT 1
- Use Docker Container to Run Devzat Servers HOT 1
- List of used plugins HOT 1
- Will not compile on Raspberry Pi HOT 18
- Tags HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devzat.