improvement on reply function.

This commit is contained in:
5elenay 2021-08-25 20:47:56 +03:00
parent 97b5b973de
commit f2d47011cb
2 changed files with 9 additions and 3 deletions

@ -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

@ -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)