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()
|
sm.CreateNonce()
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(sm.Content) < 1968 && mention {
|
sm.AddReply(m.Id, mention)
|
||||||
sm.Content = "<@" + m.AuthorId + ">, " + sm.Content
|
|
||||||
}
|
|
||||||
|
|
||||||
respMessage := &Message{}
|
respMessage := &Message{}
|
||||||
respMessage.Client = m.Client
|
respMessage.Client = m.Client
|
||||||
|
8
other.go
8
other.go
@ -1,5 +1,7 @@
|
|||||||
package revoltgo
|
package revoltgo
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
// Similar to message, but created for send message function.
|
// Similar to message, but created for send message function.
|
||||||
type SendMessage struct {
|
type SendMessage struct {
|
||||||
Content string `json:"content,omitempty"`
|
Content string `json:"content,omitempty"`
|
||||||
@ -17,6 +19,12 @@ func (sms *SendMessage) SetContent(content string) *SendMessage {
|
|||||||
return sms
|
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.
|
// Add a new attachment.
|
||||||
func (sms *SendMessage) AddAttachment(attachment string) *SendMessage {
|
func (sms *SendMessage) AddAttachment(attachment string) *SendMessage {
|
||||||
sms.Attachments = append(sms.Attachments, attachment)
|
sms.Attachments = append(sms.Attachments, attachment)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user