1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#![deny(missing_docs)]
#![feature(type_alias_impl_trait)]
use pyo3::prelude::*;
use pyo3_built::pyo3_built;
use tracing::info;
pub mod client;
mod device;
pub mod login;
mod loguru;
pub mod message;
mod utils;
const LOGO: &str = r#"
█████╗ ██╗ ██╗██████╗
██╔══██╗██║ ██║██╔══██╗
███████║██║ █╗ ██║██████╔╝
██╔══██║██║███╗██║██╔══██╗
██║ ██║╚███╔███╔╝██║ ██║
╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝ ╚═╝
"#;
#[pyfunction]
#[doc(hidden)]
pub fn init(module: &PyModule) -> PyResult<()> {
loguru::init(module)?;
info!("{}", LOGO);
Ok(())
}
#[allow(dead_code)]
pub mod build {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
}
#[pymodule]
#[doc(hidden)]
pub fn awr(py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(init, m)?)?;
m.add("__version__", env!("CARGO_PKG_VERSION"))?;
m.add("__build__", pyo3_built!(py, build))?;
m.add_function(wrap_pyfunction!(loguru::getframe, m)?)?;
m.add_class::<login::LoginMethod>()?;
m.add_class::<login::Password>()?;
#[cfg(feature = "qrcode")]
{
m.add_class::<login::QrCode>()?;
}
m.add_class::<login::Dynamic>()?;
m.add_class::<client::Client>()?;
m.add_class::<message::elements::At>()?;
m.add_class::<message::elements::Face>()?;
m.add_class::<message::content::MessageContent>()?;
Ok(())
}