Join us on Discord!
You can help CodeWalrus stay online by donating here.

[Bot][Python][Telegram] Telegram Bot API / W-800/ Telegram&IRC link?

Started by Duke "Tape" Eiyeron, June 26, 2015, 07:01:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Duke "Tape" Eiyeron

Hello everyone, time for another project! This one is a bot/library project I went crazy about since yesterday late night : creating a bot for Telegram.

Some users among us are chatting in our own group, and the moment I saw that Telegram made their own API to make bot creation easier was like a revelation : we could have our own WalriiBot! I still don't know where it could be handy, so I started to code something to allow to be extended once we get some really useful uses to it.

This comes this repository. Basically, it's the core of the future bot. It allow the dev to get an access to the API and link plugins/handlers which will be notified when something that they expect occurs.

So yeah, we'll have soon our own fully fledged WalriiBot. Also some keep asking me to make this the Telegram<->IRC link. Why not? But I'll need some help on the IRC part, if something is brave enough to fight the Mighty Python at my sides!

Edit : Here goes the W-800 (previously WalriiBot) repository : https://github.com/Eiyeron/W-800
  • Calculators owned: A lot.

Snektron


Python approves

Anyway, cool idea :D Though im not much on telegram. I was getting annoyed by all the notifications so i disabled them :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Duke "Tape" Eiyeron

Well, it'd be a good reason for ya to come back among us and program some fun functions to us!
  • Calculators owned: A lot.

Dream of Omnimaga

Yeah I have notifications disabled for the NSFW group. I have them enabled for the main group, but it depends if I am trying to sleep and don't want my phone to vibrate every 3 second.

And yeah Eiyeron this project idea was why I brought up that topic http://codewalr.us/index.php?topic=562.0 . Of course, Street is against linking the current group up with IRC since it's meant to be private, but I guess we could have an alternate public group that is still invite-only, but with the chat being possible on both IRC and Telegram's ends. More importantly, though, new post notifications would be nice for new people who are not aware yet about the two post notifier softwares. But yeah for a Telegram <-> IRC link, there is already a software for that on Github in the other thread, if you don't feel like doing one from scratch. :P
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Duke "Tape" Eiyeron

For now, it replies when one says "/walrii" as a test for my command dispatcher I just created. Commands are strings treated as pattern mzatching the beginning of a received message. If the pattern for a callback matches, the callback will be sent. Nothing more complicated.
  • Calculators owned: A lot.

Dream of Omnimaga

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Duke "Tape" Eiyeron

Actually it just "resends" the sticker we created. It doesn't upload anything. I have to test if the upload routines work.
  • Calculators owned: A lot.

Duke "Tape" Eiyeron

Also update time : More error catches to avoid the bot going seppuku at the first bad request, splitting the update system form the API itself and testing file uploads.
  • Calculators owned: A lot.

novenary

Sounds fun. Do you use an asynchronous library to communicate with the server ?

Duke "Tape" Eiyeron

No. I wanted to get a webhook working (getting updates fro mTelegram's server by playing the role of a mini-server and couldn't do the job as I only get in loop the frigging same update (WalriiBot getting in the chat). So , I had to switch over a getUpdates loop to fetch the updates and pass them to the handlers. An async loop can be doable as the API is now independant from the update loop. Put your update in a thread and you should be able to send requests and to control the loop remotely. :D
  • Calculators owned: A lot.

Duke "Tape" Eiyeron

#11
Edit : here goes the source of the bot. It still needs to be commented or to be given a README but the thing is there. https://github.com/Eiyeron/W-800

Edit2 : /xkcd [comic_number] and /ddg search_term are added
  • Calculators owned: A lot.

Dream of Omnimaga

Thanks for this bot. I wonder if it would be easy to implement post notifications?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

bb010g

For everyone interested in Telegram bot development, there's a Telegram group that you can join at http://liberbot.meteor.com/.
  • Calculators owned: HP 50g, Prime, 28S, 35S, Casio Prizm, dead Nspire CX CAS

Duke "Tape" Eiyeron

Big big update time : Merged file_upload branch as it's checked as working, commented functions, got help from someone into making the Model functions less cty. Well, this project is getting more and more better.
  • Calculators owned: A lot.

Powered by EzPortal