Skip to content

Commit

Permalink
update sites images
Browse files Browse the repository at this point in the history
  • Loading branch information
umputun committed Dec 7, 2023
1 parent d5720ac commit d2247a1
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 12 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ race_test:

prep_site:
cp -fv README.md site/docs/index.md
sed -i 's|https://raw.githubusercontent.com/umputun/tg-spam/master/site/docs/logo.png|logo.png|' site/docs/index.md
sed -i 's|^.*https://github.com/umputun/tg-spam/workflows/build/badge.svg.*$$||' site/docs/index.md
cd site && mkdocs build

sed -i '' 's|https:\/\/github.com\/umputun\/tg-spam\/raw\/master\/site\/tg-spam-bg.png|logo.png|' site/docs/index.md
sed -i '' 's|^.*/workflows/ci.yml.*$$||' site/docs/index.md

.PHONY: docker race_test prep_site
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
Anti-Spam bot for Telegram.

<div align="center">

[![build](https://github.com/umputun/tg-spam/actions/workflows/ci.yml/badge.svg)](https://github.com/umputun/tg-spam/actions/workflows/ci.yml)&nbsp;[![Coverage Status](https://coveralls.io/repos/github/umputun/tg-spam/badge.svg?branch=master)](https://coveralls.io/github/umputun/tg-spam?branch=master)&nbsp;[![Go Report Card](https://goreportcard.com/badge/github.com/umputun/tg-spam)](https://goreportcard.com/report/github.com/umputun/tg-spam)&nbsp;[![Docker Hub](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/r/umputun/tg-spam)

<img class="logo" src="https://github.com/umputun/tg-spam/raw/master/site/tg-spam-bg.png" width="400px" alt="TG-Spam | Spam Hunter"/>
</div>

## What is it and how it works?
Expand All @@ -21,6 +19,12 @@ Spam detection based on several factors:

If the message is considered spam, the bot will delete it and ban the user.

<div align="center">

[![build](https://github.com/umputun/tg-spam/actions/workflows/ci.yml/badge.svg)](https://github.com/umputun/tg-spam/actions/workflows/ci.yml)&nbsp;[![Coverage Status](https://coveralls.io/repos/github/umputun/tg-spam/badge.svg?branch=master)](https://coveralls.io/github/umputun/tg-spam?branch=master)&nbsp;[![Go Report Card](https://goreportcard.com/badge/github.com/umputun/tg-spam)](https://goreportcard.com/report/github.com/umputun/tg-spam)&nbsp;[![Docker Hub](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/r/umputun/tg-spam)

</div>

## Admin chat/group

Optionally, user can specify the admin chat/group name/id. In this case, the bot will send a message to the admin chat as soon as a spammer detected. Admin can unban the user by clicking the "unban" link in the message.
Expand Down
Binary file modified site/docs/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
104 changes: 104 additions & 0 deletions site/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# tg-spam

Anti-Spam bot for Telegram.

<div align="center">



</div>

## What is it and how it works?

The bot is designed to run as a docker container. It requires a token and a group name/id to work. The bot will listen to all messages in the group and ban users who post spam.

Spam detection based on several factors:
- similarity to known spam messages
- number of emojis in the message
- check user against [Combot Anti-Spam System](https://cas.chat) (CAS)
- check the overall similarity of the message to the known spam messages
- compare with the list of stop words

If the message is considered spam, the bot will delete it and ban the user.

## Admin chat/group

Optionally, user can specify the admin chat/group name/id. In this case, the bot will send a message to the admin chat as soon as a spammer detected. Admin can unban the user by clicking the "unban" link in the message.

In order to allow such a feature, all the params in `admin` section must be specified.

## Getting bot token for Telegram

To get a token, talk to [BotFather](https://core.telegram.org/bots#6-botfather). All you need is to send `/newbot` command and choose the name for your bot (it must end in `bot`). That is it, and you got a token which you'll need to write down into remark42 configuration as `TELEGRAM_TOKEN`.

_Example of such a "talk"_:

```
Umputun:
/newbot
BotFather:
Alright, a new bot. How are we going to call it? Please choose a name for your bot.
Umputun:
example_comments
BotFather:
Good. Now let's choose a username for your bot. It must end in `bot`. Like this, for example: TetrisBot or tetris_bot.
Umputun:
example_comments_bot
BotFather:
Done! Congratulations on your new bot. You will find it at t.me/example_comments_bot. You can now add a description, about section and profile picture for your bot, see /help for a list of commands. By the way, when you've finished creating your cool bot, ping our Bot Support if you want a better username for it. Just make sure the bot is fully operational before you do this.
Use this token to access the HTTP API:
12345678:xy778Iltzsdr45tg
```


## Application Options

```
Application Options:
-l, --logs= path to spam logs (default: logs) [$SPAM_LOGS]
--super= super-users
--similarity-threshold= spam threshold (default: 0.5) [$SIMILARITY_THRESHOLD]
--min-msg-len= min message length to check (default: 50) [$MIN_MSG_LEN]
--max-emoji= max emoji count in message (default: 2) [$MAX_EMOJI]
--paranoid paranoid mode, check all messages [$PARANOID]
--dry dry mode, no bans [$DRY]
--dbg debug mode [$DEBUG]
--tg-dbg telegram debug mode [$TG_DEBUG]
telegram:
--telegram.token= telegram bot token [$TELEGRAM_TOKEN]
--telegram.group= group name/id [$TELEGRAM_GROUP]
--telegram.timeout= http client timeout for telegram (default: 30s) [$TELEGRAM_TIMEOUT]
--telegram.idle= idle duration (default: 30s) [$TELEGRAM_IDLE]
admin:
--admin.url= admin root url [$ADMIN_URL]
--admin.address= admin listen address (default: :8080) [$ADMIN_ADDRESS]
--admin.secret= admin secret [$ADMIN_SECRET]
--admin.group= admin group name/id [$ADMIN_GROUP]
cas:
--cas.api= CAS API (default: https://api.cas.chat) [$CAS_API]
--cas.timeout= CAS timeout (default: 5s) [$CAS_TIMEOUT]
files:
--files.samples-spam= path to spam samples (default: spam-samples.txt) [$FILES_SAMPLES_SPAM]
--files.samples-ham= path to ham samples (default: ham-samples.txt) [$FILES_SAMPLES_HAM]
--files.exclude-tokens= path to exclude tokens file (default: exclude-tokens.txt) [$FILES_EXCLUDE_TOKENS]
--files.stop-words= path to stop words file (default: stop-words.txt) [$FILES_STOP_WORDS]
message:
--message.startup= startup message [$MESSAGE_STARTUP]
--message.spam= spam message (default: this is spam) [$MESSAGE_SPAM]
--message.dry= spam dry message (default: this is spam (dry mode)) [$MESSAGE_DRY]
Help Options:
-h, --help Show this help message
```
Binary file added site/docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed site/logo.png
Binary file not shown.
11 changes: 6 additions & 5 deletions site/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ copyright: Some rights reserved &copy; 2023 Umputun
theme:
name: material
custom_dir: overrides
favicon: favicon.svg
favicon: favicon.png
language: en
palette:
- scheme: slate
media: "(prefers-color-scheme: dark)"
primary: orange
primary: blue grey
features:
- navigation.instant
- toc.follow
Expand All @@ -39,12 +39,12 @@ extra:
- icon: fontawesome/brands/github
link: https://github.com/umputun
- icon: fontawesome/brands/docker
link: https://hub.docker.com/r/umputun/tg-spam/
link: https://hub.docker.com/r/umputun/spot/
- icon: fontawesome/brands/twitter
link: https://twitter.com/umputun
analytics:
provider: custom
analytic_id: 9db03a56-ef6f-4c36-b73e-c058b8a29c11
analytic_id: 04942b40-0a7a-47a1-9dbc-76eb9a9e7999

markdown_extensions:
- smarty
Expand All @@ -69,6 +69,7 @@ markdown_extensions:
emoji_index: !!python/name:materialx.emoji.twemoji
- pymdownx.highlight:
anchor_linenums: true
use_pygments: true
- pymdownx.inlinehilite
- pymdownx.keys
- pymdownx.mark
Expand All @@ -85,4 +86,4 @@ markdown_extensions:
- pymdownx.tilde

nav:
- Reproxy: index.md
- TG-SPAM: index.md
Binary file added site/tg-spam-bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d2247a1

Please sign in to comment.