B4A Library Telegram Bots API

The same library here compiled for B4A .
SMMTeleBot
Author:
SMM
Version: 1.12
  • AnswerInlineQuery
    Methods:
    • Initialize (inlineQueryId As java.lang.String, results As smm.telebot.InlineQueryResultWrapper[]) As smm.telebot.AnswerInlineQueryWrapper
    • nextOffset (nextOffset As java.lang.String) As smm.telebot.AnswerInlineQueryWrapper
    • cacheTime (cacheTime As int) As smm.telebot.AnswerInlineQueryWrapper
    • isPersonal (isPersonal As boolean) As smm.telebot.AnswerInlineQueryWrapper
    • switchPmText (switchPmText As java.lang.String) As smm.telebot.AnswerInlineQueryWrapper
    • switchPmParameter (switchPmParameter As java.lang.String) As smm.telebot.AnswerInlineQueryWrapper
    • IsInitialized As boolean
  • BaseRequest
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • IsInitialized As boolean
  • BaseResponse
    Methods:
    • Initialize As void
    • description As java.lang.String
    • isOk As boolean
    • errorCode As int
    • parameters As com.pengrad.telegrambot.model.ResponseParameters
    • IsInitialized As boolean
  • CallbackQuery
    Methods:
    • message As smm.telebot.cMessage
    • id As java.lang.String
    • Initialize As smm.telebot.CallbackQueryWrapper
    • gameShortName As java.lang.String
    • chatInstance As java.lang.String
    • inlineMessageId As java.lang.String
    • data As java.lang.String
    • from As smm.telebot.cUser
    • IsInitialized As boolean
  • Audio
    Methods:
    • fileSize As java.lang.Integer
    • fileId As java.lang.String
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • title As java.lang.String
    • duration As java.lang.Integer
    • performer As java.lang.String
    • mimeType As java.lang.String
    • IsInitialized As boolean
  • Chat
    Methods:
    • id As java.lang.Long
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • lastName As java.lang.String
    • title As java.lang.String
    • username As java.lang.String
    • firstName As java.lang.String
    • type As java.lang.String
    • IsInitialized As boolean
  • Contact
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • lastName As java.lang.String
    • phoneNumber As java.lang.String
    • userId As java.lang.Integer
    • firstName As java.lang.String
    • IsInitialized As boolean
  • Document
    Methods:
    • fileSize As java.lang.Integer
    • fileId As java.lang.String
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • fileName As java.lang.String
    • thumb As smm.telebot.cPhotoSize
    • mimeType As java.lang.String
    • IsInitialized As boolean
  • Location
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • longitude As java.lang.Float
    • latitude As java.lang.Float
    • IsInitialized As boolean
  • Message
    Methods:
    • voice As smm.telebot.cVoice
    • location As smm.telebot.cLocation
    • newChatMember As smm.telebot.cUser
    • migrateFromChatId As java.lang.Long
    • chat As smm.telebot.cChat
    • from As smm.telebot.cUser
    • date As java.lang.Integer
    • contact As smm.telebot.cContact
    • migrateToChatId As java.lang.Long
    • newChatTitle As java.lang.String
    • channelChatCreated As java.lang.Boolean
    • document As smm.telebot.cDocument
    • replyToMessage As smm.telebot.cMessage
    • video As smm.telebot.cVideo
    • IsInitialized As boolean
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • text As java.lang.String
    • supergroupChatCreated As java.lang.Boolean
    • newChatPhoto As anywheresoftware.b4a.objects.collections.List
    • audio As smm.telebot.cAudio
    • deleteChatPhoto As java.lang.Boolean
    • caption As java.lang.String
    • photo As com.pengrad.telegrambot.model.PhotoSize[]
    • forwardDate As java.lang.Integer
    • forwardFrom As smm.telebot.cUser
    • sticker As smm.telebot.cSticker
    • leftChatParticipant As smm.telebot.cUser
    • messageId As java.lang.Integer
    • groupChatCreated As java.lang.Boolean
  • PhotoSize
    Methods:
    • fileSize As java.lang.Integer
    • fileId As java.lang.String
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • height As java.lang.Integer
    • width As java.lang.Integer
    • IsInitialized As boolean
  • sendResponse
    Methods:
    • message As com.pengrad.telegrambot.model.Message
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • isOk As boolean
    • IsInitialized As boolean
  • Sticker
    Methods:
    • fileSize As java.lang.Integer
    • fileId As java.lang.String
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • height As java.lang.Integer
    • width As java.lang.Integer
    • thumb As smm.telebot.cPhotoSize
    • IsInitialized As boolean
  • Update
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • updateId As java.lang.Integer
    • editedChannelPost As smm.telebot.cMessage
    • callbackQuery As smm.telebot.CallbackQueryWrapper
    • message As smm.telebot.cMessage
    • editedMessage As smm.telebot.cMessage
    • inlineQuery As smm.telebot.InlineQueryWrapper
    • chosenInlineResult As com.pengrad.telegrambot.model.ChosenInlineResult
    • channelPost As smm.telebot.cMessage
    • IsInitialized As boolean
  • User
    Methods:
    • id As java.lang.Integer
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • lastName As java.lang.String
    • username As java.lang.String
    • firstName As java.lang.String
    • IsInitialized As boolean
  • Video
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • width As java.lang.Integer
    • fileId As java.lang.String
    • fileSize As java.lang.Integer
    • duration As java.lang.Integer
    • height As java.lang.Integer
    • thumb As smm.telebot.cPhotoSize
    • mimeType As java.lang.String
    • IsInitialized As boolean
  • Voice
    Methods:
    • fileSize As java.lang.Integer
    • fileId As java.lang.String
    • Initialize (ba As anywheresoftware.b4a.BA) As void
    • duration As java.lang.Integer
    • mimeType As java.lang.String
    • IsInitialized As boolean
  • InlineKeyboardButton
    Methods:
    • Initialize (text As java.lang.String) As smm.telebot.InlineKeyboardButtonWrapper
    • url (url As java.lang.String) As smm.telebot.InlineKeyboardButtonWrapper
    • switchInlineQueryCurrentChat (switchInlineQueryCurrentChat As java.lang.String) As smm.telebot.InlineKeyboardButtonWrapper
    • callbackGame (callbackGame As java.lang.String) As smm.telebot.InlineKeyboardButtonWrapper
    • switchInlineQuery (switchInlineQuery As java.lang.String) As smm.telebot.InlineKeyboardButtonWrapper
    • callbackData (callbackData As java.lang.String) As smm.telebot.InlineKeyboardButtonWrapper
    • IsInitialized As boolean
  • InlineKeyboardMarkup
    Methods:
    • Initialize (keyboard As smm.telebot.InlineKeyboardButtonWrapper[]) As void
    • IsInitialized As boolean
  • InlineQueryResultArticle
    Methods:
    • Initialize (id As java.lang.String, title As java.lang.String, messageText As java.lang.String) As void
    • hideUrl (hideUrl As java.lang.Boolean) As smm.telebot.InlineQueryResultArticleWrapper
    • url (url As java.lang.String) As smm.telebot.InlineQueryResultArticleWrapper
    • thumbHeight (thumbHeight As int) As smm.telebot.InlineQueryResultArticleWrapper
    • description (description As java.lang.String) As smm.telebot.InlineQueryResultArticleWrapper
    • thumbUrl (thumbUrl As java.lang.String) As smm.telebot.InlineQueryResultArticleWrapper
    • thumbWidth (thumbWidth As int) As smm.telebot.InlineQueryResultArticleWrapper
    • IsInitialized As boolean
  • InlineQueryResultPhoto
    Methods:
    • Initialize (id As java.lang.String, photoUrl As java.lang.String, thumbUrl As java.lang.String) As void
    • photoHeight (photoHeight As int) As smm.telebot.InlineQueryResultPhotoWrapper
    • caption (caption As java.lang.String) As smm.telebot.InlineQueryResultPhotoWrapper
    • title (title As java.lang.String) As smm.telebot.InlineQueryResultPhotoWrapper
    • description (description As java.lang.String) As smm.telebot.InlineQueryResultPhotoWrapper
    • photoWidth (photoWidth As int) As smm.telebot.InlineQueryResultPhotoWrapper
    • IsInitialized As boolean
  • InlineQueryResult
    Methods:
    • Initialize (type As java.lang.String, id As java.lang.String) As void
    • replyMarkup (replyMarkup As smm.telebot.InlineKeyboardMarkupWrapper) As smm.telebot.InlineQueryResultWrapper
    • inputMessageContent (inputMessageContent As smm.telebot.InputMessageContentWrapper) As smm.telebot.InlineQueryResultWrapper
    • IsInitialized As boolean
  • InlineQuery
    Methods:
    • id As java.lang.String
    • Initialize As void
    • location As smm.telebot.cLocation
    • query As java.lang.String
    • from As smm.telebot.cUser
    • offset As java.lang.String
    • IsInitialized As boolean
  • InputMessageContent
    Methods:
    • Initialize As void
    • IsInitialized As boolean
  • InputTextMessageContent
    Fields:
    • PARSEMODE_HTML As java.lang.String
    • PARSEMODE_MARKDOWN As java.lang.String
    Methods:
    • Initialize (messageText As java.lang.String) As void
    • parseMode (parseMode As java.lang.String) As smm.telebot.InputTextMessageContentWrapper
    • disableWebPagePreview (disableWebPagePreview As java.lang.Boolean) As smm.telebot.InputTextMessageContentWrapper
    • IsInitialized As boolean
  • KeyboardButton
    Methods:
    • requestContact (requestContact As boolean) As smm.telebot.KeyboardButtonWrapper
    • Initialize (ba As anywheresoftware.b4a.BA, text As java.lang.String) As void
    • requestLocation (requestLocation As boolean) As smm.telebot.KeyboardButtonWrapper
    • IsInitialized As boolean
  • ReplyKeyboardMarkup
    Methods:
    • resizeKeyboard (resizeKeyboard As boolean) As smm.telebot.ReplyKeyboardMarkupWrapper
    • Initialize (ba As anywheresoftware.b4a.BA, keyboard As java.lang.String[]) As smm.telebot.ReplyKeyboardMarkupWrapper
    • selective (selective As boolean) As smm.telebot.ReplyKeyboardMarkupWrapper
    • oneTimeKeyboard (oneTimeKeyboard As boolean) As smm.telebot.ReplyKeyboardMarkupWrapper
    • IsInitialized As boolean
  • SMMTeleBot
    Events:
    • sent (result As Message)
    • _updates (updates As List)
    Fields:
    • PARSEMODE_HTML As java.lang.Object
    • CHAT_ACTION_UPLOAD_DOCUMENT As com.pengrad.telegrambot.model.request.ChatAction
    • CHAT_ACTION_RECORD_AUDIO As com.pengrad.telegrambot.model.request.ChatAction
    • CHAT_ACTION_TYPING As com.pengrad.telegrambot.model.request.ChatAction
    • CHAT_ACTION_FIND_LOCATION As com.pengrad.telegrambot.model.request.ChatAction
    • CHAT_ACTION_UPLOAD_AUDIO As com.pengrad.telegrambot.model.request.ChatAction
    • CHAT_ACTION_UPLOAD_VIDEO As com.pengrad.telegrambot.model.request.ChatAction
    • CHAT_ACTION_RECORD_VIDEO As com.pengrad.telegrambot.model.request.ChatAction
    • PARSEMODE_MARKDOWN As java.lang.Object
    • CHAT_ACTION_UPLOAD_PHOTO As com.pengrad.telegrambot.model.request.ChatAction
    Methods:
    • Initialize (ba As anywheresoftware.b4a.BA, Token As java.lang.String, EventName As java.lang.String, connectTimeout As int, writeTimeout As int, readTimeout As int) As void
    • sendVideo (chatId As java.lang.String, folder As java.lang.String, filename As java.lang.String, caption As java.lang.String, reply_to_message_id As java.lang.Integer, bForceReply As boolean, bReplyKeyboardHide As boolean, duration As int) As void
    • AnswerCallbackQuery (callbackQueryId As java.lang.String, text As java.lang.String, url As java.lang.String, showAlert As boolean, cacheTime As int) As smm.telebot.BaseResponseWrapper
    • removeGetUpdatesListener As void
    • SendChatAction (chatId As java.lang.Object, action As java.lang.String) As void
    • sendMessage (chatId As java.lang.String, MessageText As java.lang.String, replyToMessageId As int, parsemode As java.lang.String, replyMarkup As smm.telebot.InlineKeyboardMarkupWrapper) As void
    • AnswerInlineQuery (inlineQuery As smm.telebot.InlineQueryWrapper, r1 As smm.telebot.InlineQueryResultWrapper, cacheTime As int, isPersonal As boolean, offset As java.lang.String, pmParam As java.lang.String, pmText As java.lang.String) As smm.telebot.BaseResponseWrapper
    • CreateInlineKeyboardMarkup (keys As smm.telebot.InlineKeyboardButtonWrapper[]) As smm.telebot.InlineKeyboardMarkupWrapper
    • sendPhoto (chatId As java.lang.String, folder As java.lang.String, filename As java.lang.String, caption As java.lang.String, reply_to_message_id As int, bForceReply As boolean, bReplyKeyboardHide As boolean) As void
    • SetWebhookListener (url As java.lang.String, allowedUpdates As java.lang.String, maxConnections As int) As void
    • GetUpdatesList (offset As int, limit As int, timeout As int) As void
    • sendMessage2 (chatId As java.lang.String, MessageText As java.lang.String, replyToMessageId As int, parsemode As java.lang.String, replyMarkup As smm.telebot.ReplyKeyboardMarkupWrapper) As void
 

Attachments

  • B4ASMMTeleBot112.zip
    294.2 KB · Views: 1,067
  • SMMTeleBot13.zip
    35.8 KB · Views: 923
Last edited:

DonManfred

Expert
Licensed User
Longtime User
I dont know. I do not use this lib.
 

Dave61

Member
Licensed User
Longtime User
I am having trouble getting this to work.

If I add the lSMMTeleBot library I get the following error regarding missing java-telegram-bot-api-full.jar file so I added that.
I then had to add okhttp-3.3.1.jar which it also complains about.
Then, recompiling my app, without any new code added - I get the following error:

Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Address;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Authenticator;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Authenticator$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheRequestImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheRequestImpl$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheResponseBody;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:696)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.runDx(Main.java:293)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:688)

I would definitely like to add in Telegram messages to my app. Don't suppose anyone knows the solution or another Telegram library?
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I am having trouble getting this to work.

If I add the lSMMTeleBot library I get the following error regarding missing java-telegram-bot-api-full.jar file so I added that.
I then had to add okhttp-3.3.1.jar which it also complains about.
Then, recompiling my app, without any new code added - I get the following error:

Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Address;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Authenticator;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Authenticator$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$2;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheRequestImpl;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheRequestImpl$1;
Uncaught translation error: java.lang.IllegalArgumentException: already added: Lokhttp3/Cache$CacheResponseBody;
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Translation has been interrupted
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:696)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:315)
at com.android.dx.command.dexer.Main.runDx(Main.java:293)
at com.android.dx.command.dexer.Main.main(Main.java:249)
at com.android.dx.command.Main.main(Main.java:94)
Caused by: java.lang.InterruptedException: Too many errors
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:688)

I would definitely like to add in Telegram messages to my app. Don't suppose anyone knows the solution or another Telegram library?
Did you reference okhttp library ?
 

Dave61

Member
Licensed User
Longtime User
Ah, I think that answer led me to the problem - I already had another version of okhttp in my library folder.

And now I suspect my okhttp 3.3.1.jar that I downloaded might not work as there was no .xml file with it.
Looks like I need to search for the necessary .jar & .xml file somewhere...
 

DonManfred

Expert
Licensed User
Longtime User
And now I suspect my okhttp 3.3.1.jar that I downloaded might not work as there was no .xml file with it.
Looks like I need to search for the necessary .jar & .xml file somewhere...
sounds like the wrong solution. There are no such files.

Correct is to use okhttputils. Do not reference another okhttp.jar
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Ah, I think that answer led me to the problem - I already had another version of okhttp in my library folder.

And now I suspect my okhttp 3.3.1.jar that I downloaded might not work as there was no .xml file with it.
Looks like I need to search for the necessary .jar & .xml file somewhere...
No , okhttp jar has no xml

sounds like the wrong solution. There are no such files.

Correct is to use okhttputils. Do not reference another okhttp.jar
I think it was my fault , this library needs okhttp jar but I believe it did not work with the standard one (B4A's one )
I should have make it an #AdditionalJar instead of @DependsOn
 

Dave61

Member
Licensed User
Longtime User
I might have to give up on this.
I have okhttputils library ticked and still get the same error as above.
I tried with and without the okhttp library ticked but it makes so difference - still the same error.
 

pompierecattivo

Member
Licensed User
Longtime User
Hello,
io still use this old thread because i think my problem is strictly joined (but i can start a new one, of course)
I cannot run this library because there is a stop searching google json (gson) jar library
The first line of debug is:

B4X:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/gson/Gson;

I have two version of gson library (gson-2.8.5.jar and gson-2.8.6.jar) on both lib folders, external and internal.

Any idea or help appreciate, thank you.
 

pompierecattivo

Member
Licensed User
Longtime User
This is a problem. You should never put additional jars into the internal libraryfolder unless you are told to put them there.

Thanks for quick answer.

I've paste jar on internal folder cause 'end of ideas'.... ;)

Ok. I've removed all unecessary. Actually only gson-2.8.5.jar (installed with my version ov b4a) is on internal library folder. This ismy starting point, of course i still receive error compiling code.
The use of ' #AdditionalJar' (on the manifest, i suppose) you suggest is just if i want include some library. But this case .jar is on internal lib folder...
 

pompierecattivo

Member
Licensed User
Longtime User
...to be more precise....
the error i post before is the first one happen, immediately followed by:

B4X:
java.lang.reflect.InvocationTargetException

happen on the line who call the library

B4X:
    gram.Initialize( "1000000000:yyyyyyyyyyyyyyyyyyyA","telegramma",5000,5000,5000)

I suppose this secon one is strictly related to the first...
 
Top