Wechaty Vorpal Chat CLI (Command Line Interface)
Image: Tales of Zestiria
- Node.js v16+
- NPM v7+
- Wechaty v0.40+
- WechatyVorpal v0.2+
You are welcome to send your Vorpal Extension to our contrib by creating a Pull Request!
# | Extension | Author | Feature |
---|---|---|---|
1 | Ding | @huan | Get a reply of dong |
2 | Eval | @huan | Run JavaSCript in your Wechaty bot right in the chat window! |
3 | Cash | @huan | Cross-platform Linux commands in pure ES6 |
4 | MathMaster | @huan | Text game on WeChat: to become a math master! |
5 | Whoru | @huan | Make the bot do a introduction about itself |
6 | Version | @huan | Show the dependencies/devDependencies of the bot |
import { Wechaty } from 'wechaty'
import { WechatyVorpal } from 'wechaty-vorpal'
import { Eval } from 'wechaty-vorpal-contrib'
const vorpalExtensionList = [
Eval(), // <- Put our vorpal contrib extensions at here.
]
const VorpalPlugin = WechatyVorpal({
room: 'Your_Vorpal_CLI_Room_ID',
use: vorpalExtensionList,
})
const wechaty = new Wechaty()
wechaty.use(VorpalPlugin)
The Wechaty Vorpal Contrib includes the most useful commands from the Wechaty Contributors.
If you believe we should add more command to the contrib, please feel free to submit an proposal by creating an new issue, with your code in the PR!
import { Ding } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Ding() ]
import { Eval } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Eval() ]
To remove a member from a room, you can use the following eval
code to achieve that:
eval
const ROOM_TOPIC_RE=/Home 6/i;
const MEMBER_NAME_RE=/纸超人/i;
const room = await this.wechaty.Room.find({ topic: ROOM_TOPIC_RE });
const memberList = await room.memberAll();
const bob = memberList.filter(m => MEMBER_NAME_RE.test(m.name()))[0];
await room.say("You have violated the code of conduct of our Wechaty Developers's Room, we need to move you out of this room.", bob);
await this.wechaty.sleep(5000);
await room.say('done');
await room.del(bob);
await this.log('done');
Cash is a cross-platform implementation of Unix shell commands written in straight ES6. No native compiling and no external dependencies.
import { Cash } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Cash() ]
$ help
Commands:
alias [options] [name...]
cat [options] [files...]
cd [dir]
clear
cp [options] [args...]
echo [options] [arg...]
[options] [files...]
export [options] [name...]
false
kill [options] [process...]
ls [options] [paths...]
[options] [directory...]
[options] [args...]
pwd [files...]
sort [options] [files...]
source [file] [params...]
tail [options] [files...]
touch [options] <files...>
true
grep [options] <pattern> [files...] Grep (POSIX) implementation.
rm [options] [files...]
[options] [name...]
This extension is powered by Cash.
Learn more supported command at https://github.com/dthree/cash#supported-commands
Play game in WeChat and make you a master of math! (leader board support)
import { MathMaster } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ MathMaster() ]
Let the bot tell you about its version & server information.
import { Whoru } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Whoru() ]
Let the bot tell you its dependencies/devDependencies.
import { Version } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Version() ]
Release v1.0 of Wechaty Vorpal Contrib.
- (Sep 20, 2021): Enable ESM Modules
- Upgrade to wechaty-vorpal@0.6 to enhance the Command Action Functions
MathMaster
Extension for play game in WeChat!- Add
Whoru
andVersion
extensions.
Init the first version of Wechaty Vorpal Extensions for official Wechaty ChatOps Commands
Ding
Extension for trigger adong
replyEval
Extension for EVAL JavaScript code from the chat window!Cash
Extension for Cross-platform Linux commands in pure ES6
Huan LI (李卓桓), Tencent TVP of Chatbot, <zixia@zixia.net>
- Code & Docs © 2020 Huan LI (李卓桓) <zixia@zixia.net>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons