Modifying my telegram bot (part 1)
- Nicole Seah
- May 25, 2021
- 2 min read
Updated: Jun 12, 2021
Part 1, not because I already have future updates in mind, rather it's more of a 'keep the project open' title.
While having dinner, I suddenly thought of a new idea to implement for my bot. Honestly, after writing the code, I find that it's not very efficient and perhaps counterproductive. But anywho, the process was quite challenging after not using python for a semester, but it was really fulfilling after I managed to implement the new function!
So this 'grand' idea, was to extract dates from a forwarded/copied message - which I would, in turn, send to the bot, and have it send me a compiled list of event dates. Since I'm not sure how to store information within the bot itself, I resorted to using a separate telegram group chat which includes me and the bot.
Basically, when I forward a message to my bot (via direct message), the bot will extract the date, and send it to me in the group chat - which I have conveniently named 'Reminders'. This would help me keep track of all the dates I need to take note of automatically.
Here are a few pictures to explain what I got the bot to do.

In the picture above, I forward/copy messages which include important dates directly to the bot.

The bot extracts the date, and sends it to me in a separate telegram group - which I had to indicate it's chat_id in my code. - I did this by adding the @RawDataBot to the group chat, kudos to whoever made this bot because it made finding the id so much easier.

There are a few flaws and some major second thoughts.
I could just forward these messages to a group with just myself and name it 'Reminders' as well. And I would have more context about what's going on on a particular date as well.
Basic level data cleaning (as you can see from the picture) which I implemented did not take into account the spaces between paragraphs or slashes between dates. Plus some messages included words that would have triggered other functions as well.
It was quite frustrating because nothing was working at the start. But I got it to work (kind of) at least! Although, it probably isn't as helpful as I thought it would be during dinner. Good problem-solving exercise - if I were to be optimistic :)
I realised I didn't include a link to my code before, so here it is. I'm extremely open to feedback and help.


![What I learnt from DSTA's BrainHack [Computer Vision]](https://static.wixstatic.com/media/0291b6_4c5eedac87ab40e69532948815926ba5~mv2.png/v1/fill/w_624,h_309,al_c,q_85,enc_avif,quality_auto/0291b6_4c5eedac87ab40e69532948815926ba5~mv2.png)

Comments