diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d7c61c..8046c8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,16 @@ # Change Log All notable changes to this project will be documented in this file. -## [UNRELEASED] - 11.10.2021 +## [0.2.0] - 26.10.2021 ### Added -- Inline Query for `join`, `leave` & `everyone` -- Banned users +- Inline Mode for `join`, `leave` & `everyone` +- Banned users environment variable - Buttons for `start` message ### Changed - Code quality improvements - `start` text +- mongodb data structure +- group name max length to 40 ### Deleted - `/silent` command ## [0.1.0] - 06.10.2021 diff --git a/README.md b/README.md index d37470f..7493542 100755 --- a/README.md +++ b/README.md @@ -1,26 +1,101 @@ -#

[everyone-mention-telegram-bot](http://t.me/everyone_mention_bot) +#

[everyone-mention-telegram-bot](http://t.me/everyone_mention_bot)

# Contents * [Description](#description) -* [Getting started.](#getting-started) - * [Requirements](#requirements) - * [Installation](#installation) - * [Logs](#logs) - * [Env files](#env-files) * [Commands](#commands) * [`/join`](#join) * [`/leave`](#leave) * [`/everyone`](#everyone) * [`/groups`](#groups) * [`/start`](#start) + * [Example command flow](#example-command-flow) +* [Inline Mode](#inline-mode) + * [Usage](#usage) +* [Getting started.](#getting-started) + * [Requirements](#requirements) + * [Installation](#installation) + * [Logs](#logs) + * [Env files](#env-files) ## Description Everyone Mention Bot is simple, but useful telegram bot to gather group members attention. You can create groups per chat to mention every user that joined the group by calling one command instead of mentioning them one by one. +## Commands +*Important*: `{group-name}` is not required, if not given, it will be set to `default`. +### `/join` +Joins the group (if group did not exist before, it will be created). +``` +/join {group_name} +``` +*Examples* + +without group name + +![join default command example](docs/join_default.png) + +with group name + +![join group command example](docs/join_group.png) + +### `/leave` +Leaves the group (and deletes if no members are left). +``` +/leave {group_name} +``` +*Examples* + +without group name + +![leave default command example](docs/leave_default.png) + +with group name + +![leave group command example](docs/leave_group.png) + +### `/everyone` +Mention everyone that joined requested group. +``` +/everyone {group-name} +``` + +*Examples* + +without group name + +![everyone default command example](docs/everyone_default.png) + +with group name + +![everyone group command example](docs/everyone_group.png) + + +### `/groups` +Will display available groups for this chat as well with members count. + +![groups command example](docs/groups.png) +### `/start` +Start & Help message + +![start command example](docs/start.png) + +### Example command flow +![example command flow](docs/flow_command.png) + +## Inline Mode +Using Inline Mode is recommended because policy of bots with privacy mode enabled (https://core.telegram.org/bots/faq#what-messages-will-my-bot-get) says that command trigger is sent (without mentioning the bot) only to the last mentioned bot. So if you do have multiple bots in current chat, I might not receive your command! + +### Usage +To use inline mode, type `@everyone_mention_bot` in telegram message input or click on the `Inline Mode` button from `/start` command. + +![inline popup](docs/inline_mode_1.png) + +Type in your group name (you can leave it blank for `default` group name), then click on one of the three following options. + +![inline answer](docs/inline_mode_2.png) ## Getting started ### Requirements - `docker-compose` in version `1.25.0` @@ -68,40 +143,4 @@ docker/logs - `MONGO_INITDB_ROOT_PASSWORD` - conf from `app.env` - `MONGO_INITDB_DATABASE` - conf from `app.env` - `MONGODB_DATA_DIR` - directory to store MongoDB documents (inside a container) - - `MONDODB_LOG_DIR` - path to logs storage -## Commands -### `/join` -``` -/join -``` -Joins the group (and create if it did not exist before) given in message (`default` if not given) - -![join command example](docs/join.png) - -### `/leave` -``` -/leave -``` - -Leaves the group given in message (`default` if not given) - -![leave command example](docs/leave.png) - -### `/everyone` -``` -/everyone -``` -Will mention every member of given group (`default` if not given). - -If user does not have nickname, it will first try to assign his firstname, then random firstname from `names` python library - -![everyone command example](docs/everyone.png) - -### `/groups` -Will display available groups for this chat as well with members count. - -![groups command example](docs/groups.png) -### `/start` -Start & Help message - -![start command example](docs/start.png) + - `MONDODB_LOG_DIR` - path to logs storage \ No newline at end of file diff --git a/docker/start b/docker/start deleted file mode 100755 index 596f2d9..0000000 --- a/docker/start +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -docker-compose stop -docker-compose up -d -docker logs -f $(docker-compose ps -q app) &> app.log & \ No newline at end of file diff --git a/docs/everyone.png b/docs/everyone.png deleted file mode 100644 index 63b2550..0000000 Binary files a/docs/everyone.png and /dev/null differ diff --git a/docs/everyone_default.png b/docs/everyone_default.png new file mode 100644 index 0000000..1f555ab Binary files /dev/null and b/docs/everyone_default.png differ diff --git a/docs/everyone_group.png b/docs/everyone_group.png new file mode 100644 index 0000000..a35ae94 Binary files /dev/null and b/docs/everyone_group.png differ diff --git a/docs/flow_command.png b/docs/flow_command.png new file mode 100644 index 0000000..842e0fe Binary files /dev/null and b/docs/flow_command.png differ diff --git a/docs/groups.png b/docs/groups.png index c4e1ead..8ab9d69 100644 Binary files a/docs/groups.png and b/docs/groups.png differ diff --git a/docs/inline_mode_1.png b/docs/inline_mode_1.png new file mode 100644 index 0000000..242cfb7 Binary files /dev/null and b/docs/inline_mode_1.png differ diff --git a/docs/inline_mode_2.png b/docs/inline_mode_2.png new file mode 100644 index 0000000..a11d380 Binary files /dev/null and b/docs/inline_mode_2.png differ diff --git a/docs/join.png b/docs/join.png deleted file mode 100644 index 85749ec..0000000 Binary files a/docs/join.png and /dev/null differ diff --git a/docs/join_default.png b/docs/join_default.png new file mode 100644 index 0000000..328eefb Binary files /dev/null and b/docs/join_default.png differ diff --git a/docs/join_group.png b/docs/join_group.png new file mode 100644 index 0000000..dcf3467 Binary files /dev/null and b/docs/join_group.png differ diff --git a/docs/leave.png b/docs/leave.png deleted file mode 100644 index 2d60996..0000000 Binary files a/docs/leave.png and /dev/null differ diff --git a/docs/leave_default.png b/docs/leave_default.png new file mode 100644 index 0000000..23deef8 Binary files /dev/null and b/docs/leave_default.png differ diff --git a/docs/leave_group.png b/docs/leave_group.png new file mode 100644 index 0000000..9d6f5dc Binary files /dev/null and b/docs/leave_group.png differ diff --git a/docs/start.png b/docs/start.png index 0e48122..719b676 100644 Binary files a/docs/start.png and b/docs/start.png differ diff --git a/src/config/contents.py b/src/config/contents.py index 3aa3cdb..952a2bc 100755 --- a/src/config/contents.py +++ b/src/config/contents.py @@ -6,38 +6,36 @@ not_left = '{} did not join group `{}` before' mention_failed = 'There are no users to mention' no_groups = 'There are no groups for this chat' - # html python-telegram-bot specific start_text = """ Hello! @everyone_mention_bot here. + +Description: +I do not have access to your messages! I am here to help you with multiple user mentions. -Using Inline Mode is recommended because policy of bots with privacy mode enabled says that command trigger is sent (without mentioning the bot) only to the last mentioned bot. So if you do have multiple bots in current chat, I might not receive your command! +Usage: +Users that joined the group by /join command, can be mentioned after calling /everyone command. + +Commands: +

/join {group-name}
+Joins (or creates if group did not exist before) group. + +
/leave {group-name}
+Leaves (or deletes if no other users are left) the group + +
/everyone {group-name}
+Mentions everyone that joined the group. + +
/groups
+Show all created groups in this chat. + +
/start
+Show start & help text -Available commands: Please note {group-name} is not required, default if not given. -Join -Joins (or creates if group did not exist before) group. -
/join {group-name}
- -Leave -Leaves (or deletes if no other users are left) the group -
/leave {group-name}
- -Everyone -Mentions everyone that joined the group. -
/everyone {group-name}
- -Groups -Show all created groups in this chat. -
/groups
- -Start -Show start & help text -
/start
- -Reach out to Creator in case of any issues/questions regarding my usage. +If your chat does have multiple bots I might not receive your command according to policy of bots with privacy mode enabled - use Inline Mode to avoid this. """ diff --git a/src/validator/groupNameValidator.py b/src/validator/groupNameValidator.py index 4c89902..c910ae6 100644 --- a/src/validator/groupNameValidator.py +++ b/src/validator/groupNameValidator.py @@ -4,7 +4,7 @@ from exception.invalidArgumentException import InvalidArgumentException class GroupNameValidator: - MAX_GROUP_NAME_LENGTH: int = 20 + MAX_GROUP_NAME_LENGTH: int = 40 @staticmethod def validate(group: str) -> None: