test getchat

This commit is contained in:
shoopea 2021-11-11 23:33:34 +08:00
parent 83ccdf35df
commit 00db9c6fc5

10
main.go
View File

@ -138,11 +138,9 @@ func PillageKnight(c *tdlib.Client) {
receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100) receiver := c.AddEventReceiver(&tdlib.UpdateNewMessage{}, eventFilter, 100)
for newMsg := range receiver.Chan { for newMsg := range receiver.Chan {
updateMsg := (newMsg).(*tdlib.UpdateNewMessage) updateMsg := (newMsg).(*tdlib.UpdateNewMessage)
// senderUserID := updateMsg.Message.SenderUserID
mType := updateMsg.Message.Content.GetMessageContentEnum() mType := updateMsg.Message.Content.GetMessageContentEnum()
if mType == "messageText" { if mType == "messageText" {
/* /*
user, err := c.GetUser(senderUserID)
if err != nil { if err != nil {
fmt.Println("Pillage:", err.Error()) fmt.Println("Pillage:", err.Error())
continue continue
@ -732,9 +730,15 @@ func ForwardMsg(c *tdlib.Client, msgID int64, fromChatID int64, toChatID int64)
fmt.Printf("ForwardMsg fromChatID : %d\n", fromChatID) fmt.Printf("ForwardMsg fromChatID : %d\n", fromChatID)
fmt.Printf("ForwardMsg toChatID : %d\n", toChatID) fmt.Printf("ForwardMsg toChatID : %d\n", toChatID)
fmt.Printf("ForwardMsg msgID : %d\n", msgID) fmt.Printf("ForwardMsg msgID : %d\n", msgID)
chat, err := c.GetChat(toChatID)
if err != nil {
fmt.Printf("ForwardMsg.GetChat : error : %s\n", err.Error())
}
fmt.Printf("ForwardMsg ChatID : %d\n", chat.ID)
msgs, err := c.ForwardMessages(toChatID, fromChatID, msgIDs, false, false, false) msgs, err := c.ForwardMessages(toChatID, fromChatID, msgIDs, false, false, false)
if err != nil { if err != nil {
fmt.Printf("ForwardMsg (error) : %s\n", err.Error()) fmt.Printf("ForwardMsg.ForwardMessages : error : %s\n", err.Error())
} }
if msgs != nil { if msgs != nil {
return msgs.Messages[0].ID return msgs.Messages[0].ID