Deps: Bump twilight versions -> [0.5, 0.7) (#87)

Includes two more small changes too small to warrant PRs.
1. Removes the `shard_count` parameter from `Songbird::twilight` & `Songbird::twilight_from_config` since the cluster contains it.
2. Drops the `Arc` wrapper around `Songbird` to match against an upcoming twilight 0.7 change
This commit is contained in:
Vilgot Fredenberg
2021-08-06 12:10:42 +02:00
committed by Kyle Simpson
parent 54e75bdc28
commit 1b0bcbb5f6
4 changed files with 74 additions and 61 deletions

View File

@@ -87,11 +87,11 @@ impl Songbird {
/// [`process`].
///
/// [`process`]: Songbird::process
pub fn twilight<U>(cluster: Cluster, shard_count: u64, user_id: U) -> Arc<Self>
pub fn twilight<U>(cluster: Cluster, user_id: U) -> Self
where
U: Into<UserId>,
{
Self::twilight_from_config(cluster, shard_count, user_id, Default::default())
Self::twilight_from_config(cluster, user_id, Default::default())
}
#[cfg(feature = "twilight")]
@@ -102,25 +102,24 @@ impl Songbird {
/// [`process`].
///
/// [`process`]: Songbird::process
pub fn twilight_from_config<U>(
cluster: Cluster,
shard_count: u64,
user_id: U,
config: Config,
) -> Arc<Self>
pub fn twilight_from_config<U>(cluster: Cluster, user_id: U, config: Config) -> Self
where
U: Into<UserId>,
{
Arc::new(Self {
Self {
client_data: PRwLock::new(ClientData {
shard_count,
shard_count: cluster
.config()
.shard_scheme()
.total()
.unwrap_or_else(|| cluster.shards().len() as u64),
initialised: true,
user_id: user_id.into(),
}),
calls: Default::default(),
sharder: Sharder::Twilight(cluster),
config: Some(config).into(),
})
}
}
/// Set the bot's user, and the number of shards in use.