mirror of
http://shenjack.top:5100/shenjack/icalingua-python-bot.git
synced 2025-04-20 08:49:55 +08:00
27 lines
587 B
Rust
27 lines
587 B
Rust
pub mod files;
|
|
pub mod messages;
|
|
|
|
pub mod all_rooms;
|
|
pub mod online_data;
|
|
|
|
/// 房间 id
|
|
/// 群聊 < 0
|
|
/// 私聊 > 0
|
|
pub type RoomId = i64;
|
|
pub type UserId = i64;
|
|
pub type MessageId = String;
|
|
|
|
#[allow(unused)]
|
|
pub trait RoomIdTrait {
|
|
fn is_room(&self) -> bool;
|
|
fn is_chat(&self) -> bool { !self.is_room() }
|
|
fn as_room_id(&self) -> RoomId;
|
|
fn as_chat_id(&self) -> RoomId;
|
|
}
|
|
|
|
impl RoomIdTrait for RoomId {
|
|
fn is_room(&self) -> bool { (*self).is_negative() }
|
|
fn as_room_id(&self) -> RoomId { -(*self).abs() }
|
|
fn as_chat_id(&self) -> RoomId { (*self).abs() }
|
|
}
|