Skip to content

fix(http): forwarding allows references from other channels #2429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions twilight-http/src/request/channel/message/create_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,23 +330,22 @@ impl<'a> CreateMessage<'a> {
self
}

/// Specify the ID of another message to forward.
pub fn forward(mut self, other: Id<MessageMarker>) -> Self {
/// Specify the channel and message IDs of another message to forward.
pub fn forward(mut self, channel_id: Id<ChannelMarker>, message_id: Id<MessageMarker>) -> Self {
self.fields = self.fields.map(|mut fields| {
let channel_id = self.channel_id;

let reference = if let Some(reference) = fields.message_reference {
MessageReference {
channel_id: Some(channel_id),
message_id: Some(other),
message_id: Some(message_id),
..reference
}
} else {
MessageReference {
kind: MessageReferenceType::Forward,
channel_id: Some(channel_id),
guild_id: None,
message_id: Some(other),
message_id: Some(message_id),
fail_if_not_exists: None,
}
};
Expand Down
Loading