Page 4 of 7

Re: PureTelegram (framework for using the Telegram API)

Posted: Sun Feb 06, 2022 8:52 am
by sec
Nice one!

I have some questions:
- has it support proxy (http, or socks) connection?
- is it multi OS?

Thanks.

Re: PureTelegram (framework for using the Telegram API)

Posted: Sun Feb 06, 2022 11:44 am
by infratec
Since only 'normal' PB HTTP stuff is used, it should be work on all platforms.

If you need a proxy, you have to use

Code: Select all

HTTPProxy()
At the beginning of your code.

Re: PureTelegram (framework for using the Telegram API)

Posted: Tue Feb 08, 2022 5:55 pm
by Seymour Clufley
This is a radical update of the library, with many changes. Code that uses the library will almost certainly have to be adjusted. For this reason, I have kept a legacy version of the library available (link in OP).

I have overhauled how the GetUpdates system works. It should be simpler to use now, and also more reliable.

There are a lot of new functions.

Most importantly, there is now a help file with a quickstart guide and many code examples, showing how to use each command. I hope this will encourage more people to get up and running with Telegram/PB work.

Full change log:
BUTTONS
Renamed: AddTelegramButton() -> Telegram_AddButton()
Renamed: NewTelegramButtonRow() -> Telegram_NewButtonRow()

POSTING MESSAGES
Renamed: PostMultiplePBImages -> PostAlbumOfPBImages()
Changed: input parameters for PostPBImage()
Changed: input parameters for PostOnlineImage()
Fixed: PostOnlineImage()
Fixed: "protect_content" variable wasn't being correctly handled
Added: "protect_content" variable to PostAlbum(), PostLocation(), PostVenue(), PostContact() and PostPoll()
Changed: PostPoll() can no longer post quizzes
Added: PostQuiz()

EDITING MESSAGES
Added: ReplaceMessageMedia()
Added: ReplaceMessageImageWithPBImage()

CHATS
Added: SetChatDefaultPermissions()
Added: SetChatDefaultPermissionsMap()
Added: SetChatAdministratorPermissionsMap()
Added: SetChatAdministratorCustomTitle()
Added: LeaveChat()

UPDATES
Removed: MyTG\update() list. See NextTelegramUpdate() for how to handle updates now
Changed: InstantiateBot() now requires a folder, not a txt file
Added: NextTelegramUpdate()
Added: DeleteUpdate()
Added: ClearUpdates()
Added: new update types: #TU_Type_MessageWasPinned, #TU_Type_MessageAutoDeleteChange, #TU_Type_Invoice, #TU_Type_SuccessfulPayment and #TU_Type_ProximityAlertTriggered

INVITE LINKS
Added: CreateChatPrimaryInviteLink()

MISC.
Changed: message type constants have been shortened, eg. #Telegram_MessageType_Audio -> #TG_MessageType_Audio
Added: SendStatus()
Added: HTML help file

Re: PureTelegram (framework for using the Telegram API)

Posted: Mon Feb 14, 2022 12:22 am
by Seymour Clufley
Another update, this one focusing on commerce. I also added a few procedures that accidentally weren't included in the previous version.

The commerce functions have been fully tested.
BOTS
Added: MakeScope()
Added: AddBotCommand()
Added: SetBotCommandsForScope()
Added: GetBotCommandsForScope()
Added: DeleteBotCommandsForScope()

COMMERCE
Added: AddInvoiceItem()
Added: PostInvoice()
Added: message type: TG_MessageType_Invoice
Added: AddShippingOption()
Added: AnswerShippingQuery()
Added: AcceptPayment()
Added: DeclinePayment()

WEBHOOKS
Added: SetWebhook()
Added: GetWebhookInfo()
Added: DeleteWebhook()

STICKERS
CreateNewStickerSet(), AddStickerToSet() and UploadStickerFile() now check the file size before uploading

MISC.
Changed: SendStatus() -> SendBotStatus()
I also made a start on InlineMode stuff, but it is so mindbogglingly complicated that I don't think I will pursue it.

Re: PureTelegram (framework for using the Telegram API)

Posted: Mon Feb 14, 2022 8:05 am
by Caronte3D
Seymour Clufley wrote: Mon Feb 14, 2022 12:22 am I also made a start on InlineMode stuff, but it is so mindbogglingly complicated that I don't think I will pursue it.
I'm sorry to hear that :|
Thanks anyway by all the nice work.

Re: PureTelegram (framework for using the Telegram API)

Posted: Fri Apr 29, 2022 2:05 am
by Seymour Clufley
A new version:
Added: DownloadChatAvatar()
Added: DownloadChatAvatarToPBImage()
Changed: DownloadUserProfilePhotosToMemory() -> DownloadUserAvatarsToPBImages()
Changed: DownloadUserProfilePhotos() -> DownloadUserAvatars()
Changed: DownloadUserCurrentProfilePhoto() -> DownloadUserCurrentAvatar()
Changed: removed the word "structure" from the end of all structure names
Fixed: a few bugs with the GetNewUpdates() system
Also, I've begun adding things that Telegram have brought in with the v6.0 API update, but this work is not complete.

Re: PureTelegram (framework for using the Telegram API)

Posted: Fri Apr 29, 2022 1:40 pm
by Caronte3D
Thanks for the updates :D

Re: PureTelegram (framework for using the Telegram API)

Posted: Sun May 01, 2022 8:37 pm
by Seymour Clufley
Caronte3D wrote: Fri Apr 29, 2022 1:40 pm Thanks for the updates :D
Thank you. :)

Re: PureTelegram (framework for using the Telegram API)

Posted: Wed May 11, 2022 2:35 pm
by akamicah
Handy!

Couple of points;

Can I ask why are you saving all requests to disk before processing them, also you might want to hide your personal bot API key in the example code :P

Re: PureTelegram (framework for using the Telegram API)

Posted: Thu May 12, 2022 3:44 am
by Seymour Clufley
If you mean the updates from Telegram get saved to file... Telegram will only send an update once. If your code crashes before/during processing that update, it won't be able to request it again. Therefore, I thought it was best to save all updates to file before beginning to process them.

My own bot API key isn't in any of the example code, I'm pretty sure.

Re: PureTelegram (framework for using the Telegram API)

Posted: Thu May 12, 2022 9:58 am
by akamicah
Seymour Clufley wrote: Thu May 12, 2022 3:44 am If you mean the updates from Telegram get saved to file... Telegram will only send an update once. If your code crashes before/during processing that update, it won't be able to request it again. Therefore, I thought it was best to save all updates to file before beginning to process them.
That's fair
Seymour Clufley wrote: Thu May 12, 2022 3:44 am My own bot API key isn't in any of the example code, I'm pretty sure.
An API token is exposed in a couple of snippets;

https://www.purebasic.fr/english/viewto ... 64#p576464
https://www.purebasic.fr/english/viewto ... 41#p576741
https://www.purebasic.fr/english/viewto ... 81#p576781

Re: PureTelegram (framework for using the Telegram API)

Posted: Thu May 12, 2022 9:41 pm
by Seymour Clufley
Ah yes, that's a bot key that I just made up, for demo purposes. :)

Re: PureTelegram (framework for using the Telegram API)

Posted: Mon May 16, 2022 8:36 am
by jacdelad
Hi Seymour,
I didn't have time to try it, yet and also I didn't have a real reason to use it, but I just wanted to tell you that this Include is very impressive!

Re: PureTelegram (framework for using the Telegram API)

Posted: Tue May 17, 2022 1:31 pm
by Seymour Clufley
Thank you. :)

Re: PureTelegram (framework for using the Telegram API)

Posted: Fri Sep 30, 2022 9:07 am
by pozvonok
Hello. Thanks for your great work.
Can a bot use this API to communicate with the user in a dialogue?
without public chat.
I didn't find how to do it.