From 22268986e34f3a8da2b5f848affcafece7f5f514 Mon Sep 17 00:00:00 2001 From: shoopea Date: Thu, 11 Nov 2021 22:55:34 +0800 Subject: [PATCH] add debug --- main.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index a4bc9d2..31d3289 100644 --- a/main.go +++ b/main.go @@ -78,7 +78,7 @@ func main() { fmt.Scanln(&number) _, err := client.SendPhoneNumber(number) if err != nil { - fmt.Printf("Error sending phone number: %v", err) + fmt.Printf("Error sending phone number: %v\n", err) } } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitCodeType { fmt.Print("Enter code: ") @@ -86,7 +86,7 @@ func main() { fmt.Scanln(&code) _, err := client.SendAuthCode(code) if err != nil { - fmt.Printf("Error sending auth code : %v", err) + fmt.Printf("Error sending auth code : %v\n", err) } } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitPasswordType { fmt.Print("Enter Password: ") @@ -94,7 +94,7 @@ func main() { fmt.Scanln(&password) _, err := client.SendAuthPassword(password) if err != nil { - fmt.Printf("Error sending auth password: %v", err) + fmt.Printf("Error sending auth password: %v\n", err) } } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateReadyType { fmt.Println("Authorization Ready! Let's rock") @@ -271,9 +271,9 @@ func ListenCW(c *tdlib.Client) { msgDelete = true case "/g_withdraw": time.Sleep(1 * time.Second) - fmt.Printf("WITHDRAW VALIDATED : msg_id : %d", updateMsg.Message.ID) - fmt.Printf("WITHDRAW VALIDATED : chat_id : %d", updateMsg.Message.ChatID) - fmt.Printf("WITHDRAW VALIDATED : user_id : %d", msgUserID64) + fmt.Printf("WITHDRAW VALIDATED : msg_id : %d\n", updateMsg.Message.ID) + fmt.Printf("WITHDRAW VALIDATED : chat_id : %d\n", updateMsg.Message.ChatID) + fmt.Printf("WITHDRAW VALIDATED : user_id : %d\n", msgUserID64) _ = ForwardMsg(c, updateMsg.Message.ID, updateMsg.Message.ChatID, msgUserID64) msgDisplay = false msgDelete = false @@ -729,7 +729,10 @@ func ListenAll(c *tdlib.Client) { 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) + msgs, err := c.ForwardMessages(toChatID, fromChatID, msgIDs, false, false, false) + if err != nil { + fmt.Printf("ForwardMsg (error) : %s\n", err) + } if msgs != nil { return msgs.Messages[0].ID } else {