add debug

This commit is contained in:
shoopea 2021-11-11 22:55:34 +08:00
parent 88db4dcf8d
commit 22268986e3

17
main.go
View File

@ -78,7 +78,7 @@ func main() {
fmt.Scanln(&number) fmt.Scanln(&number)
_, err := client.SendPhoneNumber(number) _, err := client.SendPhoneNumber(number)
if err != nil { 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 { } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitCodeType {
fmt.Print("Enter code: ") fmt.Print("Enter code: ")
@ -86,7 +86,7 @@ func main() {
fmt.Scanln(&code) fmt.Scanln(&code)
_, err := client.SendAuthCode(code) _, err := client.SendAuthCode(code)
if err != nil { 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 { } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateWaitPasswordType {
fmt.Print("Enter Password: ") fmt.Print("Enter Password: ")
@ -94,7 +94,7 @@ func main() {
fmt.Scanln(&password) fmt.Scanln(&password)
_, err := client.SendAuthPassword(password) _, err := client.SendAuthPassword(password)
if err != nil { 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 { } else if currentState.GetAuthorizationStateEnum() == tdlib.AuthorizationStateReadyType {
fmt.Println("Authorization Ready! Let's rock") fmt.Println("Authorization Ready! Let's rock")
@ -271,9 +271,9 @@ func ListenCW(c *tdlib.Client) {
msgDelete = true msgDelete = true
case "/g_withdraw": case "/g_withdraw":
time.Sleep(1 * time.Second) time.Sleep(1 * time.Second)
fmt.Printf("WITHDRAW VALIDATED : msg_id : %d", updateMsg.Message.ID) fmt.Printf("WITHDRAW VALIDATED : msg_id : %d\n", updateMsg.Message.ID)
fmt.Printf("WITHDRAW VALIDATED : chat_id : %d", updateMsg.Message.ChatID) fmt.Printf("WITHDRAW VALIDATED : chat_id : %d\n", updateMsg.Message.ChatID)
fmt.Printf("WITHDRAW VALIDATED : user_id : %d", msgUserID64) fmt.Printf("WITHDRAW VALIDATED : user_id : %d\n", msgUserID64)
_ = ForwardMsg(c, updateMsg.Message.ID, updateMsg.Message.ChatID, msgUserID64) _ = ForwardMsg(c, updateMsg.Message.ID, updateMsg.Message.ChatID, msgUserID64)
msgDisplay = false msgDisplay = false
msgDelete = false msgDelete = false
@ -729,7 +729,10 @@ func ListenAll(c *tdlib.Client) {
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 := make([]int64, 1)
msgIDs[0] = msgID 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 { if msgs != nil {
return msgs.Messages[0].ID return msgs.Messages[0].ID
} else { } else {