This repository has been archived on 2024-01-13. You can view files and clone it, but cannot push or open issues or pull requests.
Kevin/pkg/structs/message.go
2023-04-17 17:52:14 +02:00

35 lines
540 B
Go

package structs
type Message struct {
Author string
Content string
Response string
}
func NewMessage(author, content string) *Message {
return &Message{
author,
content,
"",
}
}
func NewMessageWithResponse(author, content, response string) *Message {
return &Message{
author,
content,
response,
}
}
func (n *Message) String() string {
var out string = "### Instruction:\n" +
n.Author + " wrote " + n.Content + "\n" +
"### Response:"
if n.Response != "" {
out += "\n" + n.Response + "\n"
}
return out
}