add: order dms by last message time

This commit is contained in:
trisua 2025-06-15 18:55:19 -04:00
parent 0af95e517d
commit 9443bfb58d
6 changed files with 29 additions and 6 deletions

View file

@ -24,21 +24,26 @@ pub struct Channel {
pub members: Vec<usize>,
/// The title of the channel.
pub title: String,
/// The timestamp of the last message in the channel.
pub last_message: usize,
}
impl Channel {
/// Create a new [`Channel`].
pub fn new(community: usize, owner: usize, position: usize, title: String) -> Self {
let created = unix_epoch_timestamp();
Self {
id: Snowflake::new().to_string().parse::<usize>().unwrap(),
community,
owner,
created: unix_epoch_timestamp(),
created,
minimum_role_read: (CommunityPermission::DEFAULT | CommunityPermission::MEMBER).bits(),
minimum_role_write: (CommunityPermission::DEFAULT | CommunityPermission::MEMBER).bits(),
position,
members: Vec::new(),
title,
last_message: created,
}
}