improvement on reply function.
This commit is contained in:
parent
97b5b973de
commit
f2d47011cb
@ -122,9 +122,7 @@ func (m Message) Reply(mention bool, sm *SendMessage) (*Message, error) {
|
||||
sm.CreateNonce()
|
||||
}
|
||||
|
||||
if len(sm.Content) < 1968 && mention {
|
||||
sm.Content = "<@" + m.AuthorId + ">, " + sm.Content
|
||||
}
|
||||
sm.AddReply(m.Id, mention)
|
||||
|
||||
respMessage := &Message{}
|
||||
respMessage.Client = m.Client
|
||||
|
8
other.go
8
other.go
@ -1,5 +1,7 @@
|
||||
package revoltgo
|
||||
|
||||
import "fmt"
|
||||
|
||||
// Similar to message, but created for send message function.
|
||||
type SendMessage struct {
|
||||
Content string `json:"content,omitempty"`
|
||||
@ -17,6 +19,12 @@ func (sms *SendMessage) SetContent(content string) *SendMessage {
|
||||
return sms
|
||||
}
|
||||
|
||||
// Set and format content.
|
||||
func (sms *SendMessage) SetContentf(format string, values ...interface{}) *SendMessage {
|
||||
sms.Content = fmt.Sprintf(format, values...)
|
||||
return sms
|
||||
}
|
||||
|
||||
// Add a new attachment.
|
||||
func (sms *SendMessage) AddAttachment(attachment string) *SendMessage {
|
||||
sms.Attachments = append(sms.Attachments, attachment)
|
||||
|
Loading…
x
Reference in New Issue
Block a user