Gateway: Generic Shard and Twilight v0.8 Support (#109)
This PR adds support for twilight v0.8, mainly adapting to significant API changes introduced by v0.7. As a result of these, twilight no longer accepts arbitrary JSON input, so it seemed sensible to adapt our `Shard` design to no longer require the same. Adding to this, I've added in a trait to allow an arbitrary `Shard` to be installed, given only an implementation of a method to send a `VoiceStateUpdate`. Together, `Sharder::Generic` (songbird::shards::VoiceUpdate) and `Shard::Generic` (songbird::shards::GenericSharder) should allow any library to be hooked in to Songbird. This PR was tested using `cargo make ready` and by manually testing `examples/twilight`.
This commit is contained in:
@@ -65,6 +65,7 @@ async fn _dca(path: &OsStr) -> Result<Input, DcaError> {
|
||||
))
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct DcaMetadata {
|
||||
pub(crate) dca: Dca,
|
||||
@@ -74,12 +75,14 @@ pub(crate) struct DcaMetadata {
|
||||
pub(crate) extra: Option<serde_json::Value>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct Dca {
|
||||
pub(crate) version: u64,
|
||||
pub(crate) tool: Tool,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct Tool {
|
||||
pub(crate) name: String,
|
||||
@@ -88,6 +91,7 @@ pub(crate) struct Tool {
|
||||
pub(crate) author: String,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct Opus {
|
||||
pub(crate) mode: String,
|
||||
@@ -98,6 +102,7 @@ pub(crate) struct Opus {
|
||||
pub(crate) channels: u8,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct Info {
|
||||
pub(crate) title: Option<String>,
|
||||
@@ -107,6 +112,7 @@ pub(crate) struct Info {
|
||||
pub(crate) cover: Option<String>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct Origin {
|
||||
pub(crate) source: Option<String>,
|
||||
|
||||
Reference in New Issue
Block a user