gelin / calendar-bot Goto Github PK
View Code? Open in Web Editor NEWTelegram bot to post events notifications from calendars
License: GNU General Public License v3.0
Telegram bot to post events notifications from calendars
License: GNU General Public License v3.0
Original report by Paolo Capelli (Bitbucket: [Paolo Capelli](https://bitbucket.org/Paolo Capelli), ).
First of all congratualation for this very beautiful work!!
It would be useful have a placeholder for the calendar name in the event formatting, a thing such as {calendarname}.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Send a command-like message /help
to the channel where bot posts its notifications.
This error appears:
2018-02-23 19:07:38,283 - telegram.ext.dispatcher - ERROR - An uncaught error was raised while processing the update
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/telegram/ext/dispatcher.py", line 279, in process_update
handler.handle_update(update, self)
File "/usr/local/lib/python3.5/dist-packages/telegram/ext/messagehandler.py", line 169, in handle_update
return self.callback(dispatcher.bot, update, **optional_args)
File "/home/gelin/work/bitbucket/calendar-bot/calbot/bot.py", line 172, in unknown
bot.sendMessage(chat_id=update.message.chat_id, text="Sorry, I don't understand that command.")
AttributeError: 'NoneType' object has no attribute 'chat_id'
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
After some big uptime bot stops querying calendars periodically, so new notifications never appear.
Probably the scheduling by the python-telegram-bot
is too weak, the periodic tasks can disappear. Probably, an external scheduler can be better.
Hi there,
I was wondering if the bot is kinda offline?
It's not working sometimes for a long time. E.g. the last post was on Sep 30 but there should be some more until now. Before Sep 30 it was also "on holiday".
Config and ical address (google calendar) are fine.
Do you have any idea by any chance? Thanks a lot!
There is a periodical event which is repeated each two weeks:
BEGIN:VEVENT
DTSTART;TZID=Asia/Omsk:20190925T190000
DTEND;TZID=Asia/Omsk:20190925T203000
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=WE
EXDATE;TZID=Asia/Omsk:20200101T190000
DTSTAMP:20200407T044006Z
UID:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Omsk I
T Events;X-NUM-GUESTS=0:mailto:[email protected]
ogle.com
CREATED:20180108T111016Z
DESCRIPTION:Дата Ужин - это свободный формат\, где можно пообщаться на тем
у анализа данных\, маш.обуча.\, обсудить соревнования по ML\, ближе познако
миться. Определенной темы беседы нет\, но я думаю она сразу же найдется.\n\
n\nМесто встречи: Пиццот\, Лермонтова 8
LAST-MODIFIED:20190916T124150Z
LOCATION:Пиццот\, ул. Лермонтова\, 8\, Омск\, Омская обл.\, Россия\, 644024
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:Дата Ужин (OML)
TRANSP:OPAQUE
END:VEVENT
Some instances of this event where changed:
BEGIN:VEVENT
DTSTART;TZID=Asia/Omsk:20200408T190000
DTEND;TZID=Asia/Omsk:20200408T203000
DTSTAMP:20200407T044006Z
UID:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Omsk I
T Events;X-NUM-GUESTS=0:mailto:[email protected]
ogle.com
RECURRENCE-ID;TZID=Asia/Omsk:20200408T190000
CREATED:20180108T111016Z
DESCRIPTION:Дата Ужин - это свободный формат\, где можно пообщаться на тем
у анализа данных\, маш.обуча.\, обсудить соревнования по ML\, ближе познако
миться. Определенной темы беседы нет\, но я думаю она сразу же найдется.\n\
n\nВстречаемся в дискорде на нашем сервере: https://discord.gg/WhKnyWr.\nТе
кстовый чат в телеграмме: https://t.me/mlomsk
LAST-MODIFIED:20200329T065050Z
LOCATION:
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:Дата Ужин (OML)
TRANSP:OPAQUE
END:VEVENT
The change applies to 2020-04-08, but bot notifies not about the changed event, but about original periodical event.
The bot should work correctly when an instance of periodical event was changed.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Once it was found the same event was notified twice. The event was edit, and two versions, the old one and the new one, were notified.
Original report by Paolo Capelli (Bitbucket: [Paolo Capelli](https://bitbucket.org/Paolo Capelli), ).
The broadcasting mode now is only X hour before, it would be useful have this choice for each calendar and not for all.
Also it would be useful add another strategy based on reminder: the event is notified when the reminder of event is triggered.
So for each calendar I can choose if use strategy of X hour before or strategy based on reminder.
Hi,
Just discovered this bot.
But I'm having trouble to add calendar to my Telegram Group. When the bot ask for Telegram Channel, I don't have a clue what to add, there is no @ to be called.
Can anyone guide me? Thanks
Try to avoid manual processing of repeating event and use library which should do it for us: https://pypi.org/project/icalevents/
This may resolve this: https://sentry.io/organizations/denis-nelubin/issues/1608505444/?project=140363
Bot commands does not include the desubscription of a calendar
It would be great to have a /remove
command
Hard to reproduce but happened multiple times with this calendar:
https://calendar.google.com/calendar/ical/aqclsibjm591jbbk875uio9k40%40group.calendar.google.com/public/basic.ics (Omsk IT Events)
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Skip all the text from calendar description and post only links from it.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Google calendar may have multiple timezones.
For example:
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Omsk IT Events
X-WR-TIMEZONE:Asia/Omsk
BEGIN:VTIMEZONE
TZID:Asia/Omsk
X-LIC-LOCATION:Asia/Omsk
BEGIN:STANDARD
TZOFFSETFROM:+0600
TZOFFSETTO:+0600
TZNAME:+06
DTSTART:19700101T000000
END:STANDARD
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Asia/Almaty
X-LIC-LOCATION:Asia/Almaty
BEGIN:STANDARD
TZOFFSETFROM:+0600
TZOFFSETTO:+0600
TZNAME:+06
DTSTART:19700101T000000
END:STANDARD
END:VTIMEZONE
The bot always uses the second, however, maybe it’s better to take the first (in this case both timezones are equivalent).
Or, maybe even better is to allow to define any timezone to display the events, per calendar.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Need to support recurring events.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Novice users after some attempts to configure the bot cannot find how to disable its tries to send the calendar events and they just block the bot. Need to stop processing such accounts to avoid flood of errors.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Create periodic (weekly) event, on Saturdays.
Remove or change date of one event from the sequence.
The bot still notifies before the deleted or modifies event.
Happened on Omsk IT Events calendar
Original report by Paolo Capelli (Bitbucket: [Paolo Capelli](https://bitbucket.org/Paolo Capelli), ).
If an event has an empty description the bot print "None". It would be better if it print an empty line or nothing.
When the chat is migrated, in this case from group to supergroup, the ID of the chat changes.
Bot should process this change correctly.
https://sentry.io/organizations/denis-nelubin/issues/1556638177/
BadRequest: Chat not found
File "calbot/processing.py", line 70, in update_calendar
send_event(bot, config, event)
File "calbot/processing.py", line 102, in send_event
bot.sendMessage(chat_id=config.channel_id, text=format_event(config, event))
File "telegram/bot.py", line 60, in decorator
result = func(self, *args, **kwargs)
File "telegram/bot.py", line 85, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "telegram/utils/request.py", line 210, in _request_wrapper
raise BadRequest(message)
ChatMigrated: Group migrated to supergroup. New chat id: -1001279650841
File "calbot/processing.py", line 87, in update_calendar
text='Failed to process calendar %s:\n%s' % (config.id, e))
File "telegram/bot.py", line 60, in decorator
result = func(self, *args, **kwargs)
File "telegram/bot.py", line 85, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "telegram/utils/request.py", line 203, in _request_wrapper
message = self._parse(resp.data)
File "telegram/utils/request.py", line 160, in _parse
raise ChatMigrated(migrate_to_chat_id)
The event with such description:
DESCRIPTION:<p style="">Майский IT-субботник доверяем Gems Development!</p>
<p style="">Ребята подготовят митап для разработчиков\, на котором расскажу
т о том\, как они решают задачи\, связанные с разработкой GIS-решений и раб
отой с государством.</p><p style="">Темы докладов: \;</p><ul style=""><
li><p>Андрей Кузьмин: «Рендеринг динамических представлений на Vue.js».</p>
</li><li><p>Антон Лукьянов «Dynamic Data Shaping».</p></li><li><p>Дмитрий Д
олгушин и Дмитрий Передера: «Интеграция с Госуслугами средствами Workflow C
ore».</p></li><li><p>Виктор Викулов «Гибкие механизмы описания предметной о
бласти».</p></li></ul><p style="">Также вместе с генеральным директором Gem
s – Алексеем Дударевым\, вы увидите\, какие возможности есть у систем монит
оринга и поддержки принятия решений по развитию таких городов\, как: Казань
\, Тюмень\, Омск и Владивосток.<br></p><p style=""><br></p><p style="">Реги
страция: http://omskit.1der.link/signup</p><p style=""><br></p><p style="">
Мини-конференция пройдет в онлайн режиме на платформе Zoom в 11:00.</p><p s
tyle=""><br></p>
is posted to Telegram like this:
87-й IT-субботник
Суббота, 16 Май 2020, 11:00 Asia/Omsk
Майский IT-субботник доверяем Gems Development!Ребята подготовят митап для разработчиков, на котором расскажут о том, как они решают задачи, связанные с разработкой GIS-решений и работой с государством.Темы докладов: Андрей Кузьмин: «Рендеринг динамических представлений на Vue.js».Антон Лукьянов «Dynamic Data Shaping».Дмитрий Долгушин и Дмитрий Передера: «Интеграция с Госуслугами средствами Workflow Core».Виктор Викулов «Гибкие механизмы описания предметной области».Также вместе с генеральным директором Gems – Алексеем Дударевым, вы увидите, какие возможности есть у систем мониторинга и поддержки принятия решений по развитию таких городов, как: Казань, Тюмень, Омск и Владивосток.
Регистрация: http://omskit.1der.link/signup
Мини-конференция пройдет в онлайн режиме на платформе Zoom в 11:00.
while in Google calendar is displayed like this:
It looks like paragraphs and lists should be supported.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
To avoid such translations:
- Заходите в наш уютный телеграм чатик mlomsk.1der.link/telegram/chat (https://vk.com/away.php?to=http:%2F%2Fmlomsk.1der.link%2Ftelegram%2Fchat&post=-141957789_74&cc_key=).
- Посещайте Дата Завтраки раз в 2 недели по средам(расписание в календаре: omskit.1der.link/calendar (https://vk.com/away.php?to=http:%2F%2Fomskit.1der.link%2Fcalendar&post=-141957789_74&cc_key=)).
How can you display the time of your time zone? By the default the UTC time is shown, which is correct and everything works fine. But I wanna display CET (UTC+2).
I don't want to use the offset format, because of winter and sommer time. Thanks for your help!
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Sometimes (probably, on service restart) events.cfg
saves "None" as last_notified
.
This causes errors when loading the file later:
ValueError: invalid literal for int() with base 10: 'None'
File "calbot/calbot.py", line 45, in <module>
main()
File "calbot/calbot.py", line 39, in main
run_bot(config)
File "calbot/bot.py", line 105, in run_bot
for calendar in config.all_calendars():
File "calbot/conf.py", line 165, in all_calendars
calendar.load_events()
File "calbot/conf.py", line 453, in load_events
event.last_notified = config_parser.getint(event_id, 'last_notified', fallback=None)
File "python3.4/configparser.py", line 781, in getint
return self._get(section, int, option, raw=raw, vars=vars)
File "python3.4/configparser.py", line 776, in _get
return conv(self.get(section, option, **kwargs))
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
Current configuration:
User A has calendar A posting to channel A.
User B has calendar A posting to channel B.
Visible behaviour:
Events from calendar A appears in channel A, but not in channel B.
While the calendar A is queried twice: for user A and for user B.
Expected behaviour:
Events from calendar A are posted to both channel A and channel B.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
It looks possible to add HTML markup in events descriptions in Google Calendar.
Bot displays HTML markup with tags in Telegram (note, HTML is disabled in bot's messages).
Need to remove HTML from the events descriptions.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
This event:
BEGIN:VEVENT
DTSTART:20180210T050000Z
DTEND:20180210T080000Z
DTSTAMP:20180208T065154Z
UID:[email protected]
ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Omsk I
T Events;X-NUM-GUESTS=0:mailto:[email protected]
ogle.com
CREATED:20180120T144333Z
DESCRIPTION:10 февраля в 11:00 пройдет 5-я встреча \;<a href="https://v
k.com/mlomsk">ML клуба</a> \;в офисе \;<a href="https://vk.com/7bit
s">7bits</a>\, Таубе 5. Регистрация на встречу: \;<a href="https://vk.c
om/away.php?to=http%3A%2F%2Fmlomsk.1der.link%2Fmeetup%2Fsignup&\;post=-1
41957789_74&\;cc_key=" target="_blank">mlomsk.1der.link/meetup/signup</a
>.<br><br>В этот раз у нас будет 2 доклада: \;<br><ul><li>Применение не
йронных сетей для распознавания фраз в звуке. \; \;<br></li><li>Вне
дрение собственноручно написанной рекомендательной системы в интернет магаз
ине. \;<br></li><li>Общение!<br></li></ul><br><br>Подробности будут дал
ее в постах группы\, не пропустите.<br><br>А ещё!<br>- Заходите в наш уютны
й телеграм чатик \;<a href="https://vk.com/away.php?to=http%3A%2F%2Fmlo
msk.1der.link%2Ftelegram%2Fchat&\;post=-141957789_74&\;cc_key=" targe
t="_blank">mlomsk.1der.link/telegram/chat</a>.<br>- Посещайте Дата Завтраки
раз в 2 недели по средам(расписание в календаре: \;<a href="https://vk
.com/away.php?to=http%3A%2F%2Fomskit.1der.link%2Fcalendar&\;post=-141957
789_74&\;cc_key=" target="_blank">omskit.1der.link/calendar</a>).<br><br
><span alt="📌"></span>10 февраля в 11:00 на Таубе 5\, офис \;<a href="
https://vk.com/7bits">7bits</a> \;на первом этаже. \;<br>Регистраци
я: \;<a href="https://vk.com/away.php?to=http%3A%2F%2Fmlomsk.1der.link%
2Fmeetup%2Fsignup&\;post=-141957789_74&\;cc_key=" target="_blank">mlo
msk.1der.link/meetup/signup</a>.
LAST-MODIFIED:20180208T055458Z
LOCATION:ул. Таубе\, 5\, Омск\, Омская обл.\, Россия\, 644037
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Встреча ML-клуба
TRANSP:OPAQUE
END:VEVENT
Was displayed as:
Суббота, 10 Февраль 2018, 11:00 Asia/Almaty
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
The bot tries to verify calendars and channels availability forever. It should stop after some unsuccessful attempts.
If the previous conversation is not completed by entering the requested data or explicit /cancel
, the next conversation can be started, but the input comes to the previous conversation which confuses the user an may cause incorrect data input.
Steps to reproduce:
/format
Current format:
😺
{title}
{date:%A, %d %B %Y}{time:, %H:%M %Z}
{location}
{description}
Sample event:
😺
This is sample event
Sunday, 24 April 2022, 19:06 Asia/Omsk
It happens in Milky Way
The sample event is to demonstrate how the event can be formatted
Type a new format string to set or /cancel
/lang
Current language is en_US.UTF-8
Sample event:
😺
This is sample event
Sunday, 24 April 2022, 19:06 Asia/Omsk
It happens in Milky Way
The sample event is to demonstrate how the event can be formatted
Type another language name to set or /cancel
en
Format is updated.
Sample event:
en
/cancel
Cancelled.
Current language is en_US.UTF-8
/cancel
Sorry, there's nothing to cancel.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
It's hard to know how the processing of the calendar was completed during the last run.
It'll be good to see the result (and errors) in configs.
Original report by Denis Nelubin (Bitbucket: gelin, GitHub: gelin).
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Omsk IT Events
X-WR-TIMEZONE:Asia/Omsk
X-WR-CALDESC:
BEGIN:VTIMEZONE
TZID:Asia/Omsk
X-LIC-LOCATION:Asia/Omsk
BEGIN:STANDARD
TZOFFSETFROM:+0600
TZOFFSETTO:+0600
TZNAME:+06
DTSTART:19700101T000000
END:STANDARD
END:VTIMEZONE
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.