Giter VIP home page Giter VIP logo

cownotifier's People

Contributors

bilalyaylak avatar frozsgy avatar goksgie avatar hbostan avatar kadircet avatar metaflow avatar onlined avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cownotifier's Issues

Convert `Date` field in the header from timestamp to human readable date

Description

Currently we are writing the timestamp received from Discourse directly to the message header. This timestamp is in UTC and may cause confusion/problems when used in different timezones.

We need to be able to adjust the timezone (possibly via conf.ini file) and create the Date field in the message header in this timezone. Also we should make it (more) human readable, since the timestamp format is a bit hard to read.

Relevant Files

newsreader.py
driver.py

Handling attachemnents as different messages in Telegram

Description

Currently we convert every entity which has links in a post to an <a> tag. If there is one image link in the post this works okay with the Telegram's link preview functionality. But when there is more than one link in the post only the first link is previewed.
Instead of converting everything to <a> tags, we want to send the images/videos/documents as different messages. It would be best if the images are sent as an album (in case a post has more than one image)
There are also TODOs about attachments scattered through the code relevant to this issue.

Relevant Files

newsparser.py
newsreader.py

Filter +1 messages

+1 messages from hundreds of students are annoying.
A content filter will help a lot.

Include URL to the post

It would be nice if header section contained a url to the main post, so that you can directly go to the reply page.

Though it might mess up with the previews, as telegram usually puts a preview for only the first link, so it might make sense to put that URL as a footer.

On the other hand, discourse might be doing a more clever job on providing previews for posts(select the image with most clicks etc.) so we might wanna experiment a little bit first.

Convert relative URLs to absolute URLs

Description

For telegram to render <a> tags correctly, href attribute of the tag should be an absolute url. Discrourse, however, sometimes puts relative url to the href attribute causing the text to be rendered as plain text instead of a link.

To fix this, we need to check the links to see if they are absolute links. If they are not, we then should convert them to absolute ones by prepending them with the news.host value from the config.

Relevant Files

newsparser.py

emoji file generation/import

Description

Currently we check if the emoji_codepoints.py exists while still doing the imports and if it doesn't exists first we generate it and then continue with the imports. We need to come up with a better approach to handle this emoji lookup file. Maybe we can convert it to a json file and read it just like the config.

Relevant Files

emoji_gen.py
driver.py

Improve HTML Parsing

Description

Currently we just strip down the HTML received from Discourse (except tags) and send the telegram message with no formatting. We also directly put the image links into the message body, and since they are usually quite long links they take valuable character space and look unpleasant. Discourse sends emojis as images also, this causes the bot to convert all the emojis into links and the telegram's link preview feature results in unwanted behavior.

To solve these issues, we can use the telegram's limited html tag support. Most of the tags can be mapped to the tags which telegram supports (e.g. <h1> to <b>). Telegram also support tags, these can be used for links (including images). Telegram supports emojis natively so we just need to replace the entire emoji tag with appropriate unicode bytes.

Things To Do

  • Formatting with Telegram-supported tags
  • Link Handling
  • Emoji Handling

Related Files

newsparser.py

Filter messages about closed threads from system user

Description

Currently when a topic is closed system user automatically replies to the topic with the following message:

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.

Since this message is not useful in the context of COWNotifier (overall usefullness is also debatable), we should not forward it to the users.

Relevant Files

newsparser.py
newsreader.py

Hey Çet :)

What does it do? Please add Readme.MD file :P

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.