-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement playback controller buttons functionality
- Loading branch information
Showing
38 changed files
with
618 additions
and
205 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ | |
sqlx-cli | ||
pgcli | ||
cargo-edit | ||
openssl | ||
openssl | ||
]; | ||
|
||
# https://devenv.sh/scripts/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
use twilight_gateway::{Latency, MessageSender}; | ||
use twilight_model::{ | ||
application::interaction::message_component::MessageComponentInteractionData, channel::Message, | ||
gateway::payload::incoming::InteractionCreate, | ||
}; | ||
|
||
use crate::{command::model::PartialInteractionData, core::model::OwnedBotState}; | ||
|
||
use super::{ComponentMarker, Ctx, Location}; | ||
|
||
impl<U: Location> Ctx<ComponentMarker, U> { | ||
pub const fn from_data( | ||
inner: Box<InteractionCreate>, | ||
data: Box<MessageComponentInteractionData>, | ||
bot: OwnedBotState, | ||
latency: Latency, | ||
sender: MessageSender, | ||
) -> Self { | ||
Self { | ||
inner, | ||
bot, | ||
latency, | ||
sender, | ||
data: Some(PartialInteractionData::Component(data)), | ||
acknowledged: false, | ||
acknowledgement: None, | ||
kind: std::marker::PhantomData, | ||
location: std::marker::PhantomData, | ||
} | ||
} | ||
|
||
pub fn component_data_mut(&mut self) -> &mut MessageComponentInteractionData { | ||
let Some(PartialInteractionData::Component(data)) = self.data.as_mut() else { | ||
// SAFETY: `self` is `Ctx<ComponentMarker>`, | ||
// so `data` will always be `PartialInteractionData::Component(_)` | ||
unsafe { std::hint::unreachable_unchecked() } | ||
}; | ||
data | ||
} | ||
|
||
pub fn message(&self) -> &Message { | ||
// SAFETY: `self` is `Ctx<ComponentMarker>`, so `self.inner.message` exists | ||
unsafe { self.inner.message.as_ref().unwrap_unchecked() } | ||
} | ||
|
||
pub fn take_custom_id(&mut self) -> String { | ||
std::mem::take(&mut self.component_data_mut().custom_id) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
pub mod config; | ||
pub mod connection; | ||
pub mod controller; | ||
pub mod debug; | ||
pub mod info; | ||
pub mod misc; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.