为Message添加string方法
This commit is contained in:
parent
c2641bd6ad
commit
5cd4e2bb7e
@ -39,6 +39,7 @@ func TestLogout(t *testing.T) {
|
|||||||
func TestMessageHandle(t *testing.T) {
|
func TestMessageHandle(t *testing.T) {
|
||||||
bot := DefaultBot(Desktop)
|
bot := DefaultBot(Desktop)
|
||||||
bot.MessageHandler = func(msg *Message) {
|
bot.MessageHandler = func(msg *Message) {
|
||||||
|
fmt.Println(msg)
|
||||||
if msg.IsText() && msg.Content == "ping" {
|
if msg.IsText() && msg.Content == "ping" {
|
||||||
msg.ReplyText("pong")
|
msg.ReplyText("pong")
|
||||||
}
|
}
|
||||||
|
@ -647,3 +647,7 @@ func (a AppMessageData) IsFile() bool {
|
|||||||
func (m *Message) IsComeFromGroup() bool {
|
func (m *Message) IsComeFromGroup() bool {
|
||||||
return m.IsSendByGroup() || strings.HasPrefix(m.ToUserName, "@@")
|
return m.IsSendByGroup() || strings.HasPrefix(m.ToUserName, "@@")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Message) String() string {
|
||||||
|
return fmt.Sprintf("<%s:ID:%s>", m.MsgType, m.MsgId)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user