package beaconfire import ( "errors" "fmt" ) var ( ErrNoReceiver = errors.New("no receiver") ) type BeaconParam struct { Title string Content string Ts int64 Fmt string } func NewBeaconParam(title, content string, ts int64, fmt string) *BeaconParam { bp := &BeaconParam{ Title: title, Content: content, Ts: ts, Fmt: fmt, } return bp } func (bp BeaconParam) FormatMarkdown() string { return fmt.Sprintf("### %v\n> %v\n> %v", bp.Title, Ts2Str(bp.Ts), bp.Content) } func (bp BeaconParam) FormatHTML() string { return fmt.Sprintf("%v\n%v\n%v", bp.Title, Ts2Str(bp.Ts), bp.Content) } func (bp BeaconParam) FormatPlainText() string { return fmt.Sprintf("%v\n%v\n%v", bp.Title, Ts2Str(bp.Ts), bp.Content) } type BeaconFire interface { Name() string Send(*BeaconParam) error }