Coder Social home page Coder Social logo

calendar-bot's People

Contributors

gelin avatar olga-martyn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

calendar-bot's Issues

Error

notifications don't come in and only post the number 5 continuously
WhatsApp Image 2023-05-09 at 08 41 49

Error when reading message from channel

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'

Bot stops refreshing calendar data

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.

bot not working at the moment?

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!

Changes in periodical events are not processed correctly

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.

Suggestion for better event broadcasting

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.

How to add to Telegram Group

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

Cannot /remove a calendar

Bot commands does not include the desubscription of a calendar

It would be great to have a /remove command

Choose timezone for the calendar

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.

Support chat migrations

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)

Incorrect formatting of HTML event description

The event with such description:

DESCRIPTION:<p style="">Майский IT-субботник доверяем Gems Development!</p>
 <p style="">Ребята подготовят митап для разработчиков\, на котором расскажу
 т о том\, как они решают задачи\, связанные с разработкой GIS-решений и раб
 отой с государством.</p><p style="">Темы докладов:&nbsp\;</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:

image

It looks like paragraphs and lists should be supported.

HTML→text, don't show href when link text starts from http or www or is equal to href

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 format the time of your time zone?

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!

ValueError: invalid literal for int() with base 10: 'None'

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))

Probably cannot post the same calendar events to different channels

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.

Bot displays HTML markup

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.

Event is displayed with empty location and description

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-я встреча&nbsp\;<a href="https://v
 k.com/mlomsk">ML клуба</a>&nbsp\;в офисе&nbsp\;<a href="https://vk.com/7bit
 s">7bits</a>\, Таубе 5. Регистрация на встречу:&nbsp\;<a href="https://vk.c
 om/away.php?to=http%3A%2F%2Fmlomsk.1der.link%2Fmeetup%2Fsignup&amp\;post=-1
 41957789_74&amp\;cc_key=" target="_blank">mlomsk.1der.link/meetup/signup</a
 >.<br><br>В этот раз у нас будет 2 доклада:&nbsp\;<br><ul><li>Применение не
 йронных сетей для распознавания фраз в звуке.&nbsp\;&nbsp\;<br></li><li>Вне
 дрение собственноручно написанной рекомендательной системы в интернет магаз
 ине.&nbsp\;<br></li><li>Общение!<br></li></ul><br><br>Подробности будут дал
 ее в постах группы\, не пропустите.<br><br>А ещё!<br>- Заходите в наш уютны
 й телеграм чатик&nbsp\;<a href="https://vk.com/away.php?to=http%3A%2F%2Fmlo
 msk.1der.link%2Ftelegram%2Fchat&amp\;post=-141957789_74&amp\;cc_key=" targe
 t="_blank">mlomsk.1der.link/telegram/chat</a>.<br>- Посещайте Дата Завтраки
  раз в 2 недели по средам(расписание в календаре:&nbsp\;<a href="https://vk
 .com/away.php?to=http%3A%2F%2Fomskit.1der.link%2Fcalendar&amp\;post=-141957
 789_74&amp\;cc_key=" target="_blank">omskit.1der.link/calendar</a>).<br><br
 ><span alt="📌"></span>10 февраля в 11:00 на Таубе 5\, офис&nbsp\;<a href="
 https://vk.com/7bits">7bits</a>&nbsp\;на первом этаже.&nbsp\;<br>Регистраци
 я:&nbsp\;<a href="https://vk.com/away.php?to=http%3A%2F%2Fmlomsk.1der.link%
 2Fmeetup%2Fsignup&amp\;post=-141957789_74&amp\;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

It's possible to mix conversations

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.

Better getting of calendar timezone

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.