chore: add basic CI action
Rust Wechaty Starter Project Template that Works Out-of-the-Box
Wechaty is a RPA SDK for Wechat Individual Account that can help you create a chatbot quickly.
#![feature(async_closure)] use wechaty::prelude::*; use wechaty_puppet_service::PuppetService; #[actix_rt::main] async fn main() { let mut bot = Wechaty::new( PuppetService::new(PuppetOptions { endpoint: None, timeout: None, token: Some(env!("WECHATY_PUPPET_SERVICE_TOKEN").to_owned()), }) .await .unwrap(), ); bot.on_scan(async move |payload: ScanPayload, _ctx| { if let Some(qrcode) = payload.qrcode { println!("Visit https://wechaty.js.org/qrcode/{} to log in", qrcode) } }) .on_login(async move |payload: LoginPayload<PuppetService>, _ctx| { println!("User {} logged in", payload.contact) }) .on_message(async move |payload: MessagePayload<PuppetService>, _ctx| { println!("Message: {}", payload.message) }) .start() .await; }
Note: the example above requires nightly version of Rust since it makes use of the async_closure feature which is unstable now.
async_closure
The easiest way to get Cargo is to install the current stable release of [Rust] by using rustup. Installing Rust using rustup will also install cargo.
rustup
cargo
On Linux and macOS systems, this is done as follows:
curl https://sh.rustup.rs -sSf | sh
It will download a script, and start the installation. If everything goes well, you’ll see this appear:
Rust is installed now. Great!
On Windows, download and run [rustup-init.exe]. It will start the installation in a console and present the above message on success.
After this, you can use the rustup command to also install beta or nightly channels for Rust and Cargo.
beta
nightly
The contents above are quoted from The Cargo Book.
make install
Get a Token for your Bot first. Learn more from our Wechaty Developers Program
export WECHATY_PUPPET_SERVICE_TOKEN=your_token_at_here make bot
[](https://github.com/wechaty/rust-wechaty)
@wechaty/rust
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
rust-wechaty-getting-started
Rust Wechaty Starter Project Template that Works Out-of-the-Box
Connecting Chatbots
Wechaty is a RPA SDK for Wechat Individual Account that can help you create a chatbot quickly.
A Basic Implementation of a Rust ChatBot
Requirements
The easiest way to get Cargo is to install the current stable release of [Rust] by using
rustup. Installing Rust usingrustupwill also installcargo.On Linux and macOS systems, this is done as follows:
It will download a script, and start the installation. If everything goes well, you’ll see this appear:
On Windows, download and run [rustup-init.exe]. It will start the installation in a console and present the above message on success.
After this, you can use the
rustupcommand to also installbetaornightlychannels for Rust and Cargo.Install
Run
Get a Token for your Bot first. Learn more from our Wechaty Developers Program
Wechaty Getting Started in Multiple Languages
Badge
Maintainers
@wechaty/rust
Copyright & License