Initial v2.2.0 push

This commit is contained in:
DaXcess
2024-08-12 16:14:24 +02:00
parent d1c01e9274
commit 97c18385dd
97 changed files with 7252 additions and 5211 deletions
+14
View File
@@ -0,0 +1,14 @@
use lazy_static::lazy_static;
lazy_static! {
pub static ref DISCORD_TOKEN: String =
std::env::var("DISCORD_TOKEN").expect("missing DISCORD_TOKEN environment variable");
pub static ref DATABASE_URL: String =
std::env::var("DATABASE_URL").expect("missing DATABASE_URL environment variable");
pub static ref LINK_URL: String =
std::env::var("LINK_URL").expect("missing LINK_URL environment variable");
pub static ref SPOTIFY_CLIENT_ID: String =
std::env::var("SPOTIFY_CLIENT_ID").expect("missing SPOTIFY_CLIENT_ID environment variable");
pub static ref SPOTIFY_CLIENT_SECRET: String = std::env::var("SPOTIFY_CLIENT_SECRET")
.expect("missing SPOTIFY_CLIENT_SECRET environment variable");
}
+44
View File
@@ -0,0 +1,44 @@
mod env;
use rspotify::{AuthCodeSpotify, Config, Credentials, OAuth, Token};
use serenity::all::GatewayIntents;
#[cfg(not(debug_assertions))]
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
#[cfg(debug_assertions)]
pub const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), "-dev");
/// The "listening to" message that shows up under the Spoticord bot user
pub const MOTD: &str = "some good 'ol music";
/// The time it takes (in seconds) for Spoticord to disconnect when no music is being played
pub const DISCONNECT_TIME: u64 = 5 * 60;
pub fn discord_token() -> &'static str {
&env::DISCORD_TOKEN
}
pub fn discord_intents() -> GatewayIntents {
GatewayIntents::GUILDS | GatewayIntents::GUILD_VOICE_STATES
}
pub fn database_url() -> &'static str {
&env::DATABASE_URL
}
pub fn link_url() -> &'static str {
&env::LINK_URL
}
pub fn get_spotify(token: Token) -> AuthCodeSpotify {
AuthCodeSpotify::from_token_with_config(
token,
Credentials {
id: env::SPOTIFY_CLIENT_ID.to_string(),
secret: Some(env::SPOTIFY_CLIENT_SECRET.to_string()),
},
OAuth::default(),
Config::default(),
)
}