A chat assistant bot based on python-wechaty
Wechaty is a RPA SDK for Wechat Individual Account that can help you create a chatbot in 9 lines of Python.
- python3.7+
- APScheduler3.6.3+
- wechaty0.6.10+
- langdetect1.0.8+
- python-dateutil2.8.1+
-
Clone this repository
git clone https://github.com/kxz18/CHAssisT cd CHAssisT
-
Install Dependencies
make install # or pip install -r requirements.txt
-
Set token for your bot
# examples/ding-dong-bot.py : func-> main() # it must be donut token export WECHATY_PUPPET=wechaty-puppet-hostie export WECHATY_PUPPET_HOSTIE_TOKEN=your_token_at_here
-
Run the bot
make bot # or python examples/example.py
To use the bot in a group chat, say something and @bot to let it know you are talking to it. To use the bot in private chat, just talk to it.
-
help doc
- Send
KEY_HELP
to the bot for help on usage. Value ofKEY_HELP
depends on the language you chose, ”帮助“ for Chinese and "help" for English. - For all functions below, access to more specific expanation is available in the reply to
KEY_HELP
of the bot.
- Send
-
Tagging
- Quote some important message and reply with the tag you want to add on the message.
- When asked with some questions, the bot will try to find a answer with the tag matching the question well. If it doesn't have enough confidence on the answer it found, it will list some of the possible keywords and ask for more specific question.
- Browsing the saved message is possible. You can either browse all of them or some of them in a given time span.
- Deleting the saved message is possible. Scheduled deleting function is also available with flexible period.
- message can be saved with an expiry, after which the message will be automatically deleted.
-
timed task
- The bot can help to to send time-scheduled message, either on a certain time point or periodically.
-
member manager
- The bot will welcome newly joined members
- The bot will remove some unwelcome chatting members with a voting mechanism.
Main plugin class, can be integrated into a Wechaty bot with a use
command:
bot.use(GroupchatAssist()) # bot is a instance of Wechaty
GroupchatAssistant | API | Description |
---|---|---|
property | name( ): string | name of this plugin |
method | GroupchatAssistant(data_path: string, config_path: string) | constructor of this plugin. Data_path specifies storage path of saved data. Config_path specifies path of configuration file of database (No need to modify in most cases). |
Plugin of helping messages. User-defined help documentary is supported.
HelpSystem | API | Description |
---|---|---|
property | name( ): string | name of this plugin |
method | HelpSystem(key_help: string, key_split: string, help_dict: dict) | constructor of this plugin. Message to get help is in the format like <key_help><key_split><function_name>. User-defined help documentary should be a dict with function name as key and help message as value. |
Plugin of tagging and question-answering system.
Tagging | API | Description |
---|---|---|
property | name( ): string | name of this plugin |
method | Tagging(data_path: string, config_path: string) | constructor of this plugin. Parameters are the same as class GroupchatAssistant. |
Plugin of timed-task.
TimedTask | API | Description |
---|---|---|
property | name( ): string | name of this plugin |
method | TimedTask( ) | constructor of this plugin |
Plugin of member management.
MemberManager | API | Description |
---|---|---|
property | name( ): string | name of this plugin |
method | MemberManager(language: string) | constructor of this plugin. language specifies locale. |