wechaty-vorpal-contrib
v1.12.1
Published
Wechaty Chat CLI (Command Line Interface), Powered by Vorpal
Downloads
109
Maintainers
Readme
wechaty-vorpal-contrib
Wechaty Vorpal Chat CLI (Command Line Interface)
Image: Tales of Zestiria
Requirements
- Node.js v16+
- NPM v7+
- Wechaty v0.40+
- WechatyVorpal v0.2+
Usage
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)
Screenshot
UrlLink
Eval
Commands
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!
1 Ding
import { Ding } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Ding() ]
2 Eval
import { Eval } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Eval() ]
Eval Example
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');
3 Cash
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
4 MathMaster
Play game in WeChat and make you a master of math! (leader board support)
import { MathMaster } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ MathMaster() ]
5 Whoru
Let the bot tell you about its version & server information.
import { Whoru } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Whoru() ]
6 Version
Let the bot tell you its dependencies/devDependencies.
import { Version } from 'wechaty-vorpal-contrib'
vorpalExtensionList = [ Version() ]
Contributors
History
main v1.0 (Oct 23, 2021)
Release v1.0 of Wechaty Vorpal Contrib.
- (Sep 20, 2021): Enable ESM Modules
v0.6 (July 10, 2020)
- Upgrade to wechaty-vorpal@0.6 to enhance the Command Action Functions
MathMaster
Extension for play game in WeChat!- Add
Whoru
andVersion
extensions.
v0.2 (June 19, 2020)
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
Author
Huan LI (李卓桓), Tencent TVP of Chatbot, <[email protected]>
Copyright & License
- Code & Docs © 2020 Huan LI (李卓桓) <[email protected]>
- Code released under the Apache-2.0 License
- Docs released under Creative Commons