Extended Server to require Identifier implemented

This commit is contained in:
diamondburned (Forefront) 2020-05-20 14:11:51 -07:00
parent 3e796d5ffe
commit 107d70485e
2 changed files with 13 additions and 1 deletions

View File

@ -47,6 +47,11 @@ easily extend the API.
- CommandCompleter (optional)
### Identifier
The identifier interface forces whatever interface that embeds this one to be
uniquely identifiable.
### Server
A server is any entity that is usually a channel or a guild.

View File

@ -84,10 +84,17 @@ type CommandCompleter interface {
CompleteCommand(words []string, wordIndex int) []string
}
// Identifier requires ID() to return a uniquely identifiable string for
// whatever this is embedded into. Typically, servers and messages have IDs.
type Identifier interface {
ID() string
}
// Server is a single server-like entity that could translate to a guild, a
// channel, a chat-room, and such. A server must implement at least ServerList
// or ServerMessage, else the frontend must treat it as a no-op.
type Server interface {
Identifier
// Name returns the server's name or the service's name.
Name() (string, error)
// Implement ServerList and/or ServerMessage.
@ -155,7 +162,7 @@ type MessagesContainer interface {
// MessageHeader implements the interface for any message event.
type MessageHeader interface {
ID() string
Identifier
Time() time.Time
}