pub struct Preview {
pub message: Message,
pub channel: GuildChannel,
}Expand description
A preview containing the message and its channel.
Fields§
§message: MessageThe message to preview.
channel: GuildChannelThe channel containing the message.
Implementations§
Source§impl Preview
impl Preview
Sourceasync fn get(
args: &MessageLinkIDs,
ctx: &Context,
source_channel: &GuildChannel,
) -> Result<Preview, PreviewError>
async fn get( args: &MessageLinkIDs, ctx: &Context, source_channel: &GuildChannel, ) -> Result<Preview, PreviewError>
Retrieves a preview for the given message link.
Validates that the linked channel is not NSFW, is not a private thread or
DM, and that everyone who can view the request’s source_channel could
also view the linked channel. The expanded content is posted as a single
message that all members of source_channel can read, so the linked
channel must be at least as visible as the source channel to avoid leaking
restricted content. Public and news threads are judged by their parent
channel’s permissions, since threads do not carry their own overwrites.
When the link target is the same channel as source_channel, the
visibility checks are skipped entirely: the reply lands in that same
channel, so it cannot expose anything its readers cannot already see.