本文整理匯總了Golang中github.com/organ/golibtox.Tox.SendMessage方法的典型用法代碼示例。如果您正苦於以下問題:Golang Tox.SendMessage方法的具體用法?Golang Tox.SendMessage怎麽用?Golang Tox.SendMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/organ/golibtox.Tox
的用法示例。
在下文中一共展示了Tox.SendMessage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: onFileControl
func onFileControl(t *golibtox.Tox, friendnumber int32, sending bool, filenumber uint8, fileControl golibtox.FileControl, data []byte, length uint16) {
// Finished receiving file
if fileControl == golibtox.FILECONTROL_FINISHED {
f := transfers[filenumber]
f.Sync()
f.Close()
delete(transfers, filenumber)
fmt.Println("Written file", filenumber)
t.SendMessage(friendnumber, []byte("Thanks!"))
}
}
示例2: onFriendMessage
func onFriendMessage(t *golibtox.Tox, friendnumber int32, message []byte, length uint16) {
fmt.Printf("New message from %d : %s\n", friendnumber, string(message))
// Echo back
t.SendMessage(friendnumber, message)
}