-
Notifications
You must be signed in to change notification settings - Fork 0
/
title_end.go
37 lines (31 loc) · 865 Bytes
/
title_end.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package feragstring
import "fmt"
// TitleEnd is the struct for the FERAG title info message (%2441)
type TitleEnd struct {
FeragMessage
titleName string
}
// TitleName returns the title name segment (+40) FERAG-formatted
func (ti *TitleEnd) TitleName() string {
return fmt.Sprintf("+40%-8s", ti.titleName)
}
// SetTitleName sets the title name segment (+40)
func (ti *TitleEnd) SetTitleName(titleName string) {
ti.titleName = titleName
}
// NewTitleEnd returns a new TitleEnd struct
func NewTitleEnd() *TitleEnd {
t := TitleEnd{
FeragMessage: FeragMessage{
messageStart: "2441",
messageEnd: "!",
},
}
return &t
}
// Message returns the complete FERAG-formatted message for title end
func (ti *TitleEnd) Message() string {
message := ti.FeragMessage.MessageTemplate()
payload := ti.TitleName()
return message(&ti.FeragMessage, payload)
}