Comments in the telegram channel

    Getting acquainted with the telegram bots came out messy - at work, it was necessary to get ahead of the team of colleagues, and knowing the internal API well, the bot was written in a few days (later modified and received telegram verify badge )

    Two bots were written as a result , on which the leadership calmed down, and I started samizdat.

    Once again, playing around with the prototype, I wanted to think that you can quickly write something else interesting in the telegram stack. The choice fell on the comments.

    Bot @CommentsUserBot for comments in the telegram channel

    There are channels in the telegram, but you cannot comment on them, and there are chats where you cannot write news - you will receive either all spam messages or nothing if you go to the mute .
    Although, if you do in the chat pin with an alert, you can emulate the publication of aka in #channel.

    Upon reflection, I went to read the documentation for . I already had to write a parser for news to the corporate site for IV, and I roughly thought about what widgets exist on the platform ( however, some did not start ). Also, in the community of bot developers, I learned a few non-public APIs that came in handy later.

    Everything looked clear, and over the weekend I sketched a prototype of a comment bot to the telegram channel - a button clung to the post, going to the bot to write the text, and then generating the comments page in the telegraph. In the channel itself, the button should show the number of comments.

    Technically, the server works only at the time of the publication of comments. All the rest - text and graphics - is stored and cached by the telegraph itself.

    After stuffing the developers for testing, I collected a feedback, sketched a plan and quietly began to write down the changes. So, initially the automatic mode of updating the channel was changed by the settings (manual or auto, the replacement of the original post, or the publication of comment-post). The comments themselves were replenished with widgets, graphics and video ( thanks to Oleg O. for testing vulnerabilities. By the way, he also has a good comment @ Bot-ComBotBot ).
    At that time I installed telegram-x, and one of the important updates in it was that, once registered in the bot, you do not need to press start each time you enter from the deep link.
    Comments, since the flat chat already exists, it was decided to make a tree. I did not write such storage before, but after a couple of bulky articles the database was able to digest them. The current limiting depth of branches is 10 levels. The number of comments per page 20, with pre-show answers in the branches, the number of comments and pagination.

    Yes, the telegraph does not allow to turn around with the design of the page, but that was exactly what was needed - a bot in the telegram ecosystem - there are no additional authorizations and access to the sites. The fonts will not fly, and the comment pages themselves will work through Instant View . The user himself at the same time stuffs the comment in the usual format, in a telegram - with emoticons, stickers, links and other things.

    Editing is replaced by the addition of the current comment. In general, this is still enough, because your own comments can be deleted ( directly from the comments page ).


    Then, when the bot wanted to use large channels ( > 100k subscribers ), the question of administration arose. The deletion of an unwanted comment and user ban has been added. Also, due to personal dislike of spam, response alerts are turned off by default for the user, but the settings allow you to subscribe to both comments and channel / post comments, plus a choice of comments level. All this comes from a separate bot-spammer, so by blocking it on the basis of a dummy telegram interface, you can still write comments in other channels.

    Zadizaynenaya in gimpa icon is painted for all entities of the project - bot, alert bot, project news and chat support.

    About language interfaces: pages in the telegraph in en , and bots in en / ru (auto-detection works).
    Comments are very much in South America. Now the good Samaritans are translating the files on the githaba for more localization.
    In the spring (summer?), When the RKN began blocking accesses, I felt a little uncomfortable to develop (on the train, on the way to / c work - double ssh to the server periodically falls off), so the development rate (already low) has decreased. Now I collect reviews, make plans for improvements and write from time to time another bot, whose work I will need in the current project.

    Bot @CommentsUserBot for comments in the telegram channel.

    Connect, write, discuss)

    Also popular now: