Sign inSign up

zamazan4ik/codedetection-telegram

By zamazan4ik

•Updated almost 4 years ago

codedetection-telegram docker images

Image
0

10K+

zamazan4ik/codedetection-telegram repository overview

⁠codedetection-telegram

Detect C++ code in Telegram messages and warn about proper code formatting.

⁠Dependencies
⁠How to build
  • Clone this repository
  • cargo build --release
⁠How to run

I recommend to run this bot as a service(e.g. as systemd service) on a machine. Also Docker images are available here: https://hub.docker.com/repository/docker/zamazan4ik/codedetection-telegram⁠

⁠Configuration

The bot can be configured only with environment variables. For now there are we support the following variables:

NameDescriptionValuesDefault valueRequired
TELOXIDE_TOKENTelegram bot tokenAny valid and registered Telegram bot tokenNoneAll mods
WEBHOOK_MODERun bot in webhook mode or long-polling modetrue for webhook, 'false' for long-pollingfalseAll mods
THRESHOLDSets a threshold for code detection algorithmAny valid u83All mods
BIND_ADDRESSAddress for binding the web-serviceAny valid IP address0.0.0.0Webhook mode
BIND_PORTPort for binding the web-serviceAny valid port8080Webhook mode
HOSTHost, where Telegram will send updates in webhook modeAny valid host addressNoneWebhook mode

If for any variable there is no default value and you didn't provide any value - the bot won't start. Bot automatically registers webhook (if is launched in webhook mode) with address https://$HOST/$TELOXIDE_TOKEN/api/v1/message.

⁠How to use

Just add the bot tou your chat. If any user will write a message, which possibly is a C++ code - the bot will warn about it.

⁠Code detection algorithm

For now bot detects C++ code with very simple method: match with regular expression some keywords and if match count > THRESHOLD - send a warn. So this algorithm has some false positives (detects some non-C++ code as C++ code) and false negatives (doesn't detect some C++ code). Maybe in the future the algorithm will be improved.

⁠Feedback

If you have any suggestions or want to report a bug - feel free to create in issue in this repo. Thank you!

Tag summary

Content type

Image

Digest

sha256:17ea37021…

Size

47.7 MB

Last updated

almost 4 years ago

docker pull zamazan4ik/codedetection-telegram