Giter Club home page Giter Club logo

kotbot's Introduction

kotbot Build

Bot API 7.9

Install library

implementation("io.heapy.kotbot:core:1.0.0")

Example

Execute a single method:

suspend fun main() {
    val kotbot = Kotbot(
        token = System.getenv("KOTBOT_TOKEN"),
    )

  kotbot.execute(GetMe())
      .also(::println)
}

Subscribe for updates:

suspend fun main() {
    val kotbot = Kotbot(
        token = System.getenv("KOTBOT_TOKEN"),
    )

    // Flow, which emits updates
    kotbot.receiveUpdates()
        .onEach(::println)
}

kotbot's People

Contributors

commandertvis avatar dector avatar dependabot[bot] avatar irus avatar madhead avatar r4zzz4k avatar sergey-kozlov-developer avatar

Stargazers

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

kotbot's Issues

K-V User context

Simple K-V user context to store user-related data (ban status, karma, etc)

Ability to rename topics

Moderators should be able to change topic name, by sending message in topic:

/rename new name

Optional notification to users when they get replies to forum posts

As of now, you don't know anything about your forum post, and you can't subscribe to updates. Of course when you start participating, you'll get notifications on direct replies to you. But it's very easy to forget about the question you've posted and get back to it much later.

We should enable periodic notifications about post comments with the flow as follows:

  1. User creates a /post.
  2. Bot sends a link to the post to the user.
  3. If any replies to the post appear, bot sends a notification to the user and snoozes this post for some delay (e.g. 15 minutes).
  4. If any replies occur during snooze period, nothing happens. Replies by topic starter can probably reset snooze as those show the user is still actively monitoring replies.
  5. If the reply appears after snooze is over, bot sends a notification to the user.
  6. At some point user disables notifications for specific post in case she already got the answer she needed. For example, this can be implemented via inline keyboard button on the notification.

User should also be able to enable / disable notifications globally and change snooze delay, so that the forum workflow fits her messenger usage best.

Other users should be able to also subscribe to the post replies. This may help if you see the question you're also interested in.

Some types of posts (like polls) may need different strategies for notifications, this is a thing to consider but is out of scope for this issue.

Bot Support: Kotlin Telegram Forum

Untitled Diagram

Bot should allow to post to special forum channel, and implement limits on posting to channel (based on history of threads).
Posted thread should have inline buttons +1/-1 to moderate messages.

Ability to close topics

Moderators should be able to close “resolved” topic

/close – will mark a topic as closed, and close for posting new messages

Introduce GitHub integration

As kotbot
I want to provide push-notifications about GitHub repo activities of chat participants
So I informing chat/community members about open pull requests, branch merging and other kind of activities

  • API design
  • Integration with GitHub API
  • push implementation

Suggested commands:

  • github_authorize - connects to GitHub
  • add_github_repo - adds repository to push list
  • remove_github_repo - removes repository from push list
  • list_github_repos - lists all added repositories

Allow list for CAS banned

Telegram's bot is banned by CAS:

INFO  2020-09-30:21:17:58 [DefaultDispatcher-worker-2] io.heapy.kotbot.bot.rule.Rule: Delete joined users message [User{id=1087968824, firstName='Group', isBot=true, lastName='null', userName='GroupAnonymousBot', languageCode='null'}]
INFO  2020-09-30:21:17:58 [DefaultDispatcher-worker-2] io.heapy.kotbot.bot.rule.Rule: User 1087968824 is CAS banned

Maybe some other legit user can be banned, and we should be able to "unban" him for Kotlin chat

Introduce lock-down mode

For cases when spammer activity goes out of control, it's useful to have a tool which momentarily limits ability for new uses to make harm to a community. This could include blocking any messages from a newcomers for a limited duration with notification via pinned message, or maybe less restrictive action.

Also we could have a partial lock-down mode, which limits chat activity only when no one is actively watching, e.g. at night time or based on admins / high carma members activity (latter one may not be available via bot API though).

Support combot's CAS check

Combot provides API which could be used to check user status in their system. As the bot is used by many communities, it's database could be a good additional source for information on our newcomers.
It's also very easy to implement -- in fact, it's just one HTTP GET call.

Communicate with offenders via the bot

I propose the following flow for managing offends and related bans:

  1. Moderator registers an offend in the chat
  2. Bot limits posting ability of the offender
  3. Bot posts a message in chat requiring offender to start a chat with the bot
    After this, offender has three options:
  • Keep participating in reading mode forever
  • Leave the chat
  • Start the bot
    As soon as the offender starts the bot, bot posts notification in admin chat requesting to communicate with the offender. The communication itself should be help in chats bot-moderator and bot-offender. During this exchange moderator can decide whether the warning is enough or temporary mute is more viable option. Moderator picks the action, bot applies it to the offender.

Pros:

  • We push at least some of chat members to start the bot, which would be a useful channel for communication.
  • Moderators can stay anonymous in specific situations.
  • We will start registering reasons for restrictive actions.

[Issue] `KOTBOT_RELEASE` is required

KOTBOT_RELEASE is absent in .env-template-dev and not is not starting.
Should we add KOTBOT_RELEASE into .env-template-dev or make it optional?

Chat families

As we maintain a group of chats, the following things are quite logical to sync across them:

  • Restrictions
  • Admins

Reports sent by users, mentioned in #2, also assume connection between several chats and admin chat.

What do you thing about adding a thing called Family, which has a list of chats and an admin chat bound to it, with accompanying family management commands and mentioned synchronization?

My high-level vision on implementation:
In a chat with bot added admin can send a message /family. In response the bot would create a new family with empty chat list and current chat as an admin chat for it.
In admin chat, one can send /family-add message. The bot would respond with https://telegram.me/[botname]?startgroup=[id] link. This deep link opens chat picker. On selecting the chat bot gets added to it, and the user sends /start@botname message there (which can be removed automatically if the bot is already there and has admin rights or manually if not). This way we can setup linking between a family and new chat.
As soon as that's done and bot is granted admin rights, bot can synchronize mentioned items between chats.

Let me know if you approve the idea and if so, whether you have any notices on the usage flow.

Job postings

Right now job postings, if I understand the process, are only partially automated. This is, of course, much better than it was before, but Telegram bot may be next level solution. It can provide step-by-step workflow in filling a form, it can also automatically post it for reviewing.

So the question is as follows. Is KotBot general-purpose enough for this to be a feature of separate bot?

Ban users across chats

Make possible to block someone from posting messages to kotlin_forum (and other chats in family except from kotlin_meta) by marking kotlin_forum post as either:
/ban, /ro 1h/1d/1w/1m/1y/inf

kotlin_meta holds own block list, so people banned/read-only in chat family can write messages to kotlin_meta, until they banned there for spam or rule violation.

Post poll to forum

  1. Send poll to bot
  2. Reply to this poll with /post_poll
  3. Bot will send new poll to channel

Add limited moderation permissions to users with high carma

We have some people in community who are active, open and can be relied upon mitigation of destructive behavior in chats. Some usual chat tools like vote-kicking are effective but very easy to abuse, so limiting their usage to trusted members might be a good way to avoid their pitfalls.

If karma system is expected to be opaque, we can even allow specified people to start vote-kick and provide everyone with vote buttons, but count only votes of people with enough carma level.

Moderation

Moderation

User can't send messages, until he add this bot and answer on bot's sign up questions.

Bot commands

  • /stats Display your statistics: number of warnings and helpful flags.

Administrative commands

These commands only work for group admins.

  • !mute [reason] Reply to a user to mute them for 24 hours;
  • !fmute [reason] is forever mute;
  • !unmute Reply to a user to unmute them;
  • !channelmode Enable read-only mode. Only admins can send messages. Send the command again to disable the mode;
  • !warn [reason] Reply to a user to warn them. User will receive personal warning messages through bot. First warn just send message, second - mutes for 24 hours, third - mutes user forever. Warnings expires over time.

Community commands

These commands work for everybody.

!report Reply to a message to report it to admins;
+1 Reply to a message to mark it as helpful.

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.