Fixed url formatting and a typo

Fixed formatting

Merging suggestion

Co-authored-by: Waffle Lapkin <waffle.lapkin@gmail.com>

Fixed other typos
This commit is contained in:
hex0x0000 2021-08-22 03:37:30 +02:00
parent 64681ffb49
commit 2c53236af4

View file

@ -989,7 +989,7 @@ mod getters {
impl Message {
/// Produces a direct link to the message.
///
/// Note that for private groups the link will only be accesible for group
/// Note that for private groups the link will only be accessible for group
/// members.
///
/// Returns `None` for private chats (i.e.: DMs).
@ -1000,17 +1000,21 @@ impl Message {
// There are "tg://openmessage?user_id={0}&message_id={1}" links, which are
// supposed to open any chat, including private messages, but they
// are only supported by some telegram clients (e.g. Plus Messenger,
// Telegram for Androud 4.9+).
// Telegram for Android 4.9+).
return None;
}
let url = match self.chat.username() {
// If it's public group (i.e. not DM, not private group), we can produce
// "normal" t.me link (accesible to everyone).
// "normal" t.me link (accessible to everyone).
Some(username) => format!("https://t.me/{0}/{1}/", username, self.id),
// For private groups we produce "private" t.me/c links. These are only
// accesible to the group members.
None => format!("https://t.me/c/{0}/{1}/", self.chat.id, self.id),
// accessible to the group members.
None => format!(
"https://t.me/c/{0}/{1}/",
(-self.chat.id) - 1000000000000,
self.id
),
};
// UNWRAP: