Group name length validation increased, updated contents, readme, changelog
@ -1,14 +1,16 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## [UNRELEASED] - 11.10.2021
|
## [0.2.0] - 26.10.2021
|
||||||
### Added
|
### Added
|
||||||
- Inline Query for `join`, `leave` & `everyone`
|
- Inline Mode for `join`, `leave` & `everyone`
|
||||||
- Banned users
|
- Banned users environment variable
|
||||||
- Buttons for `start` message
|
- Buttons for `start` message
|
||||||
### Changed
|
### Changed
|
||||||
- Code quality improvements
|
- Code quality improvements
|
||||||
- `start` text
|
- `start` text
|
||||||
|
- mongodb data structure
|
||||||
|
- group name max length to 40
|
||||||
### Deleted
|
### Deleted
|
||||||
- `/silent` command
|
- `/silent` command
|
||||||
## [0.1.0] - 06.10.2021
|
## [0.1.0] - 06.10.2021
|
||||||
|
123
README.md
@ -1,26 +1,101 @@
|
|||||||
# <p align="center"> [everyone-mention-telegram-bot](http://t.me/everyone_mention_bot)
|
#<p align="center"> [everyone-mention-telegram-bot](http://t.me/everyone_mention_bot)
|
||||||
<p align="center"> <img src="docs/logo.png" width="150"/>
|
<p align="center"> <img src="docs/logo.png" width="150"/>
|
||||||
<!-- Icon made by https://www.freepik.com from https://www.flaticon.com/ -->
|
<!-- Icon made by https://www.freepik.com from https://www.flaticon.com/ -->
|
||||||
|
|
||||||
# Contents
|
# Contents
|
||||||
|
|
||||||
* [Description](#description)
|
* [Description](#description)
|
||||||
* [Getting started.](#getting-started)
|
|
||||||
* [Requirements](#requirements)
|
|
||||||
* [Installation](#installation)
|
|
||||||
* [Logs](#logs)
|
|
||||||
* [Env files](#env-files)
|
|
||||||
* [Commands](#commands)
|
* [Commands](#commands)
|
||||||
* [`/join`](#join)
|
* [`/join`](#join)
|
||||||
* [`/leave`](#leave)
|
* [`/leave`](#leave)
|
||||||
* [`/everyone`](#everyone)
|
* [`/everyone`](#everyone)
|
||||||
* [`/groups`](#groups)
|
* [`/groups`](#groups)
|
||||||
* [`/start`](#start)
|
* [`/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
|
## Description
|
||||||
Everyone Mention Bot is simple, but useful telegram bot to gather group members attention.
|
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.
|
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
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
with group name
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### `/leave`
|
||||||
|
Leaves the group (and deletes if no members are left).
|
||||||
|
```
|
||||||
|
/leave {group_name}
|
||||||
|
```
|
||||||
|
*Examples*
|
||||||
|
|
||||||
|
without group name
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
with group name
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### `/everyone`
|
||||||
|
Mention everyone that joined requested group.
|
||||||
|
```
|
||||||
|
/everyone {group-name}
|
||||||
|
```
|
||||||
|
|
||||||
|
*Examples*
|
||||||
|
|
||||||
|
without group name
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
with group name
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
### `/groups`
|
||||||
|
Will display available groups for this chat as well with members count.
|
||||||
|
|
||||||
|

|
||||||
|
### `/start`
|
||||||
|
Start & Help message
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Example command flow
|
||||||
|

|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Type in your group name (you can leave it blank for `default` group name), then click on one of the three following options.
|
||||||
|
|
||||||
|

|
||||||
## Getting started
|
## Getting started
|
||||||
### Requirements
|
### Requirements
|
||||||
- `docker-compose` in version `1.25.0`
|
- `docker-compose` in version `1.25.0`
|
||||||
@ -69,39 +144,3 @@ docker/logs <container>
|
|||||||
- `MONGO_INITDB_DATABASE` - conf from `app.env`
|
- `MONGO_INITDB_DATABASE` - conf from `app.env`
|
||||||
- `MONGODB_DATA_DIR` - directory to store MongoDB documents (inside a container)
|
- `MONGODB_DATA_DIR` - directory to store MongoDB documents (inside a container)
|
||||||
- `MONDODB_LOG_DIR` - path to logs storage
|
- `MONDODB_LOG_DIR` - path to logs storage
|
||||||
## Commands
|
|
||||||
### `/join`
|
|
||||||
```
|
|
||||||
/join <group_name>
|
|
||||||
```
|
|
||||||
Joins the group (and create if it did not exist before) given in message (`default` if not given)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### `/leave`
|
|
||||||
```
|
|
||||||
/leave <group_name>
|
|
||||||
```
|
|
||||||
|
|
||||||
Leaves the group given in message (`default` if not given)
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### `/everyone`
|
|
||||||
```
|
|
||||||
/everyone <group_id>
|
|
||||||
```
|
|
||||||
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
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### `/groups`
|
|
||||||
Will display available groups for this chat as well with members count.
|
|
||||||
|
|
||||||

|
|
||||||
### `/start`
|
|
||||||
Start & Help message
|
|
||||||
|
|
||||||

|
|
||||||
|
@ -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 &
|
|
Before Width: | Height: | Size: 33 KiB |
BIN
docs/everyone_default.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/everyone_group.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
docs/flow_command.png
Normal file
After Width: | Height: | Size: 62 KiB |
BIN
docs/groups.png
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 16 KiB |
BIN
docs/inline_mode_1.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
docs/inline_mode_2.png
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
docs/join.png
Before Width: | Height: | Size: 41 KiB |
BIN
docs/join_default.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/join_group.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
docs/leave.png
Before Width: | Height: | Size: 32 KiB |
BIN
docs/leave_default.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
docs/leave_group.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
docs/start.png
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 77 KiB |
@ -6,38 +6,36 @@ not_left = '{} did not join group `{}` before'
|
|||||||
mention_failed = 'There are no users to mention'
|
mention_failed = 'There are no users to mention'
|
||||||
no_groups = 'There are no groups for this chat'
|
no_groups = 'There are no groups for this chat'
|
||||||
|
|
||||||
|
|
||||||
# html python-telegram-bot specific
|
# html python-telegram-bot specific
|
||||||
start_text = """
|
start_text = """
|
||||||
Hello!
|
Hello!
|
||||||
@everyone_mention_bot here.
|
@everyone_mention_bot here.
|
||||||
|
|
||||||
|
<b>Description</b>:
|
||||||
|
I <b>do not</b> have access to your messages!
|
||||||
I am here to help you with multiple user mentions.
|
I am here to help you with multiple user mentions.
|
||||||
|
|
||||||
Using <code>Inline Mode</code> is recommended because <a href="https://core.telegram.org/bots/faq#what-messages-will-my-bot-get">policy of bots with privacy mode enabled</a> 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!
|
<b>Usage</b>:
|
||||||
|
Users that joined the group by <code>/join</code> command, can be mentioned after calling <code>/everyone</code> command.
|
||||||
|
|
||||||
|
<b>Commands</b>:
|
||||||
|
<pre>/join {group-name}</pre>
|
||||||
|
Joins (or creates if group did not exist before) group.
|
||||||
|
|
||||||
|
<pre>/leave {group-name}</pre>
|
||||||
|
Leaves (or deletes if no other users are left) the group
|
||||||
|
|
||||||
|
<pre>/everyone {group-name}</pre>
|
||||||
|
Mentions everyone that joined the group.
|
||||||
|
|
||||||
|
<pre>/groups</pre>
|
||||||
|
Show all created groups in this chat.
|
||||||
|
|
||||||
|
<pre>/start</pre>
|
||||||
|
Show start & help text
|
||||||
|
|
||||||
Available commands:
|
|
||||||
<b>Please note</b>
|
<b>Please note</b>
|
||||||
<code>{group-name}</code> is not required, <code>default</code> if not given.
|
<code>{group-name}</code> is not required, <code>default</code> if not given.
|
||||||
|
|
||||||
<b>Join</b>
|
If your chat does have multiple bots <b>I might not receive your command</b> according to <a href="https://core.telegram.org/bots/faq#what-messages-will-my-bot-get">policy of bots with privacy mode enabled</a> - use <code>Inline Mode</code> to avoid this.
|
||||||
Joins (or creates if group did not exist before) group.
|
|
||||||
<pre>/join {group-name}</pre>
|
|
||||||
|
|
||||||
<b>Leave</b>
|
|
||||||
Leaves (or deletes if no other users are left) the group
|
|
||||||
<pre>/leave {group-name}</pre>
|
|
||||||
|
|
||||||
<b>Everyone</b>
|
|
||||||
Mentions everyone that joined the group.
|
|
||||||
<pre>/everyone {group-name}</pre>
|
|
||||||
|
|
||||||
<b>Groups</b>
|
|
||||||
Show all created groups in this chat.
|
|
||||||
<pre>/groups</pre>
|
|
||||||
|
|
||||||
<b>Start</b>
|
|
||||||
Show start & help text
|
|
||||||
<pre>/start</pre>
|
|
||||||
|
|
||||||
Reach out to <a href="https://t.me/miloszowi">Creator</a> in case of any issues/questions regarding my usage.
|
|
||||||
"""
|
"""
|
||||||
|
@ -4,7 +4,7 @@ from exception.invalidArgumentException import InvalidArgumentException
|
|||||||
|
|
||||||
|
|
||||||
class GroupNameValidator:
|
class GroupNameValidator:
|
||||||
MAX_GROUP_NAME_LENGTH: int = 20
|
MAX_GROUP_NAME_LENGTH: int = 40
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def validate(group: str) -> None:
|
def validate(group: str) -> None:
|
||||||
|