behnam_tr Active Member Licensed User Longtime User Sep 11, 2019 #1 hi in jtelegrambot lib i use this code for get user phone number Code: Copy Dim ib As KeyboardButtonBuilder ib.Initialize Dim mark As ReplyKeyboardMarkup mark.initialize(ib.newRow.newButton("").newContactButton("send phone").newRow.build,True,True,False) but after user send i cant split phone number because Dim tell As Message =message.Contact get error log(message.Contact) is ok and result >>> Contact{phoneNumber='+98xxxxxxxxx', firstName='-----', lastName='null', userId=105526931} i think should be like this > Dim tell As contact =message.Contact but contact is missing thanks for all helps Last edited: Sep 11, 2019
hi in jtelegrambot lib i use this code for get user phone number Code: Copy Dim ib As KeyboardButtonBuilder ib.Initialize Dim mark As ReplyKeyboardMarkup mark.initialize(ib.newRow.newButton("").newContactButton("send phone").newRow.build,True,True,False) but after user send i cant split phone number because Dim tell As Message =message.Contact get error log(message.Contact) is ok and result >>> Contact{phoneNumber='+98xxxxxxxxx', firstName='-----', lastName='null', userId=105526931} i think should be like this > Dim tell As contact =message.Contact but contact is missing thanks for all helps
DonManfred Expert Licensed User Longtime User Sep 11, 2019 #2 i do not understand the question PD: NO NEED to begin a thread with hello Donmanfred. If you start the threadtitle with jtelegrambot i´ll see it. This is a commuinityforum. Upvote 0
i do not understand the question PD: NO NEED to begin a thread with hello Donmanfred. If you start the threadtitle with jtelegrambot i´ll see it. This is a commuinityforum.
behnam_tr Active Member Licensed User Longtime User Sep 11, 2019 #3 i receive this message on b4j with this code "log(message.Contact)" Contact{phoneNumber='+98xxxxxxxxx', firstName='-----', lastName='null', userId=105526931} i want to split and put in string varible coantact.phoneNumber how can i do this ?? Upvote 0
i receive this message on b4j with this code "log(message.Contact)" Contact{phoneNumber='+98xxxxxxxxx', firstName='-----', lastName='null', userId=105526931} i want to split and put in string varible coantact.phoneNumber how can i do this ??
DonManfred Expert Licensed User Longtime User Sep 13, 2019 #4 Try it with v0.22. I´ve added the Contact object. Upvote 0
behnam_tr Active Member Licensed User Longtime User Sep 21, 2019 #5 thanks after use i get this error Code: Copy Dim c As Contact c.Initialize("") c=message.Contact Dim tell As String= c.PhoneNumber Code: Copy java.lang.RuntimeException: Object should first be initialized (Contact). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32) at de.donmanfred.Contactwrapper.getPhoneNumber(Contactwrapper.java:48) at b4j.example.main._jtb_onmessagereceived(main.java:228) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.BA$3.run(BA.java:247) at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748) Upvote 0
thanks after use i get this error Code: Copy Dim c As Contact c.Initialize("") c=message.Contact Dim tell As String= c.PhoneNumber Code: Copy java.lang.RuntimeException: Object should first be initialized (Contact). at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:32) at de.donmanfred.Contactwrapper.getPhoneNumber(Contactwrapper.java:48) at b4j.example.main._jtb_onmessagereceived(main.java:228) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:91) at anywheresoftware.b4a.BA$3.run(BA.java:247) at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748)
DonManfred Expert Licensed User Longtime User Sep 21, 2019 #6 this is working for me. i send a contact to my bot Code: Copy If message.Contact <> Null Then Log($"MessageContact: ${message.Contact}"$) Dim cont As Contact = message.Contact Log($"ContactFirstname: ${cont.FirstName}"$) Log($"ContactLastName: ${cont.LastName}"$) Log($"ContactPhoneNumber: ${cont.PhoneNumber}"$) Log($"ContactUserId: ${cont.UserId}"$) End If Upvote 0
this is working for me. i send a contact to my bot Code: Copy If message.Contact <> Null Then Log($"MessageContact: ${message.Contact}"$) Dim cont As Contact = message.Contact Log($"ContactFirstname: ${cont.FirstName}"$) Log($"ContactLastName: ${cont.LastName}"$) Log($"ContactPhoneNumber: ${cont.PhoneNumber}"$) Log($"ContactUserId: ${cont.UserId}"$) End If