Made SendMessage optional, extended ServerMessageSender
This commit is contained in:
parent
668497aef0
commit
519066e136
17
README.md
17
README.md
|
@ -52,6 +52,11 @@ easily extend the API.
|
|||
The identifier interface forces whatever interface that embeds this one to be
|
||||
uniquely identifiable.
|
||||
|
||||
### Configurator
|
||||
|
||||
The configurator interface is a way for the frontend to display configuration
|
||||
options that the backend has.
|
||||
|
||||
### Server
|
||||
|
||||
A server is any entity that is usually a channel or a guild.
|
||||
|
@ -61,11 +66,21 @@ A server is any entity that is usually a channel or a guild.
|
|||
- ServerList and/or ServerMessage
|
||||
- ServerIcon (optional)
|
||||
|
||||
### ServerMessage
|
||||
|
||||
A server message is an entity that contains messages to be displayed. An example
|
||||
would be channels in Discord and IRC.
|
||||
|
||||
#### Interfaces
|
||||
|
||||
- ServerMessageSender (optional): adds message sending capability.
|
||||
- ServerMessageSendCompleter (optional): adds message completion capability.
|
||||
|
||||
### Messages
|
||||
|
||||
#### Interfaces
|
||||
|
||||
- MessageHeader
|
||||
- MessageHeader: the minimum for a proper message.
|
||||
- MessageCreate or MessageUpdate or MessageDelete
|
||||
- MessageNonce (optional)
|
||||
- MessageAuthorAvatar (optional)
|
||||
|
|
11
cchat.go
11
cchat.go
|
@ -141,10 +141,21 @@ type ServerMessage interface {
|
|||
// LeaveServer indicates the backend to stop calling the controller over.
|
||||
// This should be called before any other JoinServer() calls are made.
|
||||
LeaveServer() error
|
||||
}
|
||||
|
||||
// ServerMessageSender optionally extends ServerMessage to add message sending
|
||||
// capability to the server.
|
||||
type ServerMessageSender interface {
|
||||
// SendMessage is called by the frontend to send a message to this channel.
|
||||
SendMessage(SendableMessage) error
|
||||
}
|
||||
|
||||
// ServerMessageSendCompleter optionally extends ServerMessageSender to add
|
||||
// autocompletion into the message composer.
|
||||
type ServerMessageSendCompleter interface {
|
||||
CompleteMessage(words []string, wordIndex int) []string
|
||||
}
|
||||
|
||||
// SendableMessage is the bare minimum interface of a sendable message, that is,
|
||||
// a message that can be sent with SendMessage().
|
||||
type SendableMessage interface {
|
||||
|
|
Loading…
Reference in New Issue