Make clippy happy, add tokio monitoring
This commit is contained in:
@@ -19,14 +19,14 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||
EmbedBuilder::new()
|
||||
.title("Spoticord Help")
|
||||
.icon_url("https://spoticord.com/logo-standard.webp")
|
||||
.description(format!("**Welcome to Spoticord**
|
||||
.description("**Welcome to Spoticord**
|
||||
It seems you have requested some help. Not to worry, we can help you out.\n
|
||||
**Not sure how the bot works?**
|
||||
**[Click here](https://spoticord.com/#how-to)** for a quick overview about how to set up Spoticord and how to use it.\n
|
||||
**Which commands are there?**
|
||||
You can find all **[the commands](https://spoticord.com/#commands)** on the website. You may also just type `/` in Discord and see which commands are available there.\n
|
||||
**Need more help?**
|
||||
If you still need some help, whether you are having issues with the bot or you just want to give us some feedback, you can join our **[Discord server](https://discord.gg/wRCyhVqBZ5)**."))
|
||||
If you still need some help, whether you are having issues with the bot or you just want to give us some feedback, you can join our **[Discord server](https://discord.gg/wRCyhVqBZ5)**.".to_string())
|
||||
.status(Status::Info)
|
||||
.build(),
|
||||
false,
|
||||
|
||||
@@ -17,9 +17,13 @@ pub const NAME: &str = "link";
|
||||
pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutput {
|
||||
Box::pin(async move {
|
||||
let data = ctx.data.read().await;
|
||||
let database = data.get::<Database>().unwrap();
|
||||
let database = data.get::<Database>().expect("to contain a value");
|
||||
|
||||
if let Ok(_) = database.get_user_account(command.user.id.to_string()).await {
|
||||
if database
|
||||
.get_user_account(command.user.id.to_string())
|
||||
.await
|
||||
.is_ok()
|
||||
{
|
||||
respond_message(
|
||||
&ctx,
|
||||
&command,
|
||||
@@ -35,7 +39,7 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||
}
|
||||
|
||||
if let Ok(request) = database.get_user_request(command.user.id.to_string()).await {
|
||||
let base = std::env::var("SPOTICORD_ACCOUNTS_URL").unwrap();
|
||||
let base = std::env::var("SPOTICORD_ACCOUNTS_URL").expect("to be present");
|
||||
let link = format!("{}/spotify/{}", base, request.token);
|
||||
|
||||
respond_message(
|
||||
@@ -102,7 +106,7 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||
.await
|
||||
{
|
||||
Ok(request) => {
|
||||
let base = std::env::var("SPOTICORD_ACCOUNTS_URL").unwrap();
|
||||
let base = std::env::var("SPOTICORD_ACCOUNTS_URL").expect("to be present");
|
||||
let link = format!("{}/spotify/{}", base, request.token);
|
||||
|
||||
respond_message(
|
||||
@@ -121,9 +125,8 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||
true,
|
||||
)
|
||||
.await;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Err(why) => {
|
||||
error!("Error creating user request: {:?}", why);
|
||||
|
||||
@@ -137,8 +140,6 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||
true,
|
||||
)
|
||||
.await;
|
||||
|
||||
return;
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ pub const NAME: &str = "rename";
|
||||
pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutput {
|
||||
Box::pin(async move {
|
||||
let data = ctx.data.read().await;
|
||||
let database = data.get::<Database>().unwrap();
|
||||
let database = data.get::<Database>().expect("to contain a value");
|
||||
|
||||
// Check if user exists, if not, create them
|
||||
if let Err(why) = database.get_user(command.user.id.to_string()).await {
|
||||
@@ -65,7 +65,7 @@ pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutpu
|
||||
|
||||
let device_name = match command.data.options.get(0) {
|
||||
Some(option) => match option.value {
|
||||
Some(ref value) => value.as_str().unwrap().to_string(),
|
||||
Some(ref value) => value.as_str().expect("to be a string").to_string(),
|
||||
None => {
|
||||
respond_message(
|
||||
&ctx,
|
||||
|
||||
@@ -17,8 +17,8 @@ pub const NAME: &str = "unlink";
|
||||
pub fn run(ctx: Context, command: ApplicationCommandInteraction) -> CommandOutput {
|
||||
Box::pin(async move {
|
||||
let data = ctx.data.read().await;
|
||||
let database = data.get::<Database>().unwrap();
|
||||
let session_manager = data.get::<SessionManager>().unwrap();
|
||||
let database = data.get::<Database>().expect("to contain a value");
|
||||
let session_manager = data.get::<SessionManager>().expect("to contain a value");
|
||||
|
||||
// Disconnect session if user has any
|
||||
if let Some(session) = session_manager.find(command.user.id).await {
|
||||
|
||||
Reference in New Issue
Block a user