mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-15 10:10:12 +00:00
chore: merge avatars service into monorepo
This commit is contained in:
parent
f427d4d727
commit
17f5561293
27 changed files with 1925 additions and 111 deletions
|
|
@ -89,10 +89,22 @@ fn member_to_cached_member(item: Member, id: Id<UserMarker>) -> CachedMember {
|
|||
}
|
||||
|
||||
pub fn new() -> DiscordCache {
|
||||
let mut client_builder =
|
||||
twilight_http::Client::builder().token(libpk::config.discord.bot_token.clone());
|
||||
let mut client_builder = twilight_http::Client::builder().token(
|
||||
libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.bot_token
|
||||
.clone(),
|
||||
);
|
||||
|
||||
if let Some(base_url) = libpk::config.discord.api_base_url.clone() {
|
||||
if let Some(base_url) = libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.api_base_url
|
||||
.clone()
|
||||
{
|
||||
client_builder = client_builder.proxy(base_url, true);
|
||||
}
|
||||
|
||||
|
|
@ -136,7 +148,13 @@ impl DiscordCache {
|
|||
return Ok(Permissions::all());
|
||||
}
|
||||
|
||||
let member = if user_id == libpk::config.discord.client_id {
|
||||
let member = if user_id
|
||||
== libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.client_id
|
||||
{
|
||||
self.0
|
||||
.member(guild_id, user_id)
|
||||
.ok_or(format_err!("self member not found"))?
|
||||
|
|
@ -202,7 +220,13 @@ impl DiscordCache {
|
|||
return Ok(Permissions::all());
|
||||
}
|
||||
|
||||
let member = if user_id == libpk::config.discord.client_id {
|
||||
let member = if user_id
|
||||
== libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.client_id
|
||||
{
|
||||
self.0
|
||||
.member(guild_id, user_id)
|
||||
.ok_or_else(|| {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ use super::{cache::DiscordCache, shard_state::ShardStateManager};
|
|||
pub fn cluster_config() -> ClusterSettings {
|
||||
libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.cluster
|
||||
.clone()
|
||||
.unwrap_or(libpk::_config::ClusterSettings {
|
||||
|
|
@ -51,10 +53,18 @@ pub fn create_shards(redis: fred::pool::RedisPool) -> anyhow::Result<Vec<Shard<R
|
|||
let shards = create_iterator(
|
||||
start_shard..end_shard + 1,
|
||||
cluster_settings.total_shards,
|
||||
ConfigBuilder::new(libpk::config.discord.bot_token.to_owned(), intents)
|
||||
.presence(presence("pk;help", false))
|
||||
.queue(queue.clone())
|
||||
.build(),
|
||||
ConfigBuilder::new(
|
||||
libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.bot_token
|
||||
.to_owned(),
|
||||
intents,
|
||||
)
|
||||
.presence(presence("pk;help", false))
|
||||
.queue(queue.clone())
|
||||
.build(),
|
||||
|_, builder| builder.build(),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,11 @@ use libpk::util::redis::RedisErrorExt;
|
|||
pub fn new(redis: RedisPool) -> RedisQueue {
|
||||
RedisQueue {
|
||||
redis,
|
||||
concurrency: libpk::config.discord.max_concurrency,
|
||||
concurrency: libpk::config
|
||||
.discord
|
||||
.as_ref()
|
||||
.expect("missing discord config")
|
||||
.max_concurrency,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue