Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

yejingchen/jieba-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jieba-bot

This is a simple Telegram inline bot providing Chinese word segmentation powered by the Jieba algorithm.

The official instance is @jiebabot.

example.png

Build

Requries rustc 1.39+ for async/await.

# debug build
cargo build
# or, optimized build
cargo build --release

Running

Configurations including bot token is provided at runtime via environment variables.

  • BOT_TOKEN: required. This is what you get from botfather when you create a bot.
  • RUST_LOG: controls the logging behavior, for example: info, debug, jieba_bot=debug, tbot, etc. See the log crate.
  • HTTPS_PROXY: in the form of http[s]://host:port. Currently only http and https proxy is supported.
RUST_LOG=info BOT_TOKEN=xxxxxx cargo run --release

Alternatively, you can use systemd to manage the service. A demo systemd service and an EnvironmentFile are included. Place the service file in /etc/systemd/system, put the executable at /usr/local/bin/jieba-bot, put jieba-bot.conf in /etc, and issue a systemctl daemon-reload. Then you can start and enable the jieba-bot service using normal systemd commands.

Miscellaneous

Q: Why not write this in Python?

A: Because I'm afraid of programming in dynamically-typed languages :)

Privacy

This bot records nothing at all. All messages are discarded once processed.

License

This work is released under the WTFPL license. A copy of the license is provided in the LICENSE file.

About

Chinese word segmentation Telegram bot

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages