test forward

This commit is contained in:
shoopea 2019-08-27 11:32:41 +08:00
parent f2b759ad47
commit c7645ba99c

14
td.go
View File

@ -196,14 +196,7 @@ func getHistory(c *tdlib.Client, chatID64 *int64, senderUserID64 *int64) {
} }
func ForwardMsg(c *tdlib.Client, msgID int64, fromChatID int64, toChatID int64) int64 { func ForwardMsg(c *tdlib.Client, msgID int64, fromChatID int64, toChatID int64) int64 {
msgIDs := make([]int64, 1)
msgIDs[0] = msgID
msgs, _ := c.ForwardMessages(toChatID, fromChatID, msgIDs, false, false, false)
if msgs != nil {
return msgs.Messages[0].ID
} else {
return 0
}
} }
func DeleteMsg(c *tdlib.Client, chatID int64, msgID int64) { func DeleteMsg(c *tdlib.Client, chatID int64, msgID int64) {
@ -236,6 +229,11 @@ func clientMsg(c *tdlib.Client, m TGCommand) {
} }
switch m.Type { switch m.Type {
case commandForwardMsg:
msgIDs := make([]int64, 1)
msgIDs[0] = msgID
c.ForwardMessages(m.ToChatID64, m.FromChatID64, msgIDs, false, false, false)
case commandSendMsg: case commandSendMsg:
msgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(m.Text, nil), true, true) msgTxt := tdlib.NewInputMessageText(tdlib.NewFormattedText(m.Text, nil), true, true)
if m.ToChatID64 != 0 { if m.ToChatID64 != 0 {