cargo fmt
This commit is contained in:
parent
fa7b47c3a5
commit
c42faaf6a3
2 changed files with 18 additions and 8 deletions
|
@ -127,12 +127,20 @@ async fn submit(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
let guild = msg.guild_id.unwrap().as_u64().to_string();
|
||||
let current_guild_data = &guild_data[&guild].as_object().unwrap();
|
||||
if !guild_data.contains_key(&guild) || !current_guild_data.contains_key("submissionChannel") {
|
||||
msg.reply(&ctx.http, "Submissions aren't enabled for this server yet.").await?;
|
||||
msg.reply(&ctx.http, "Submissions aren't enabled for this server yet.")
|
||||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
let submission_channel = current_guild_data["submissionChannel"].as_str().unwrap();
|
||||
if submission_channel != &msg.channel_id.as_u64().to_string() {
|
||||
msg.reply(&ctx.http, format!("Sorry, submissions aren't permitted here. Please go to <#{}>. Thanks!", guild)).await?;
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
format!(
|
||||
"Sorry, submissions aren't permitted here. Please go to <#{}>. Thanks!",
|
||||
guild
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
return Ok(());
|
||||
}
|
||||
if msg.attachments.len() == 0 {
|
||||
|
|
|
@ -2,9 +2,9 @@ use serenity::framework::standard::{macros::command, CommandResult};
|
|||
use serenity::model::prelude::*;
|
||||
use serenity::prelude::*;
|
||||
|
||||
use serde_json::json;
|
||||
use serde_json::Map;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use std::fs::File;
|
||||
use std::fs::OpenOptions;
|
||||
use std::io::Read;
|
||||
|
@ -83,12 +83,14 @@ async fn setSubmissionChannel(ctx: &Context, msg: &Message) -> CommandResult {
|
|||
}
|
||||
guild_data[&guild] = current_guild_data.into();
|
||||
} else {
|
||||
guild_data.insert(guild, json!({
|
||||
"submissionChannel": channel
|
||||
}));
|
||||
guild_data.insert(guild, json!({ "submissionChannel": channel }));
|
||||
}
|
||||
set_guild_data(guild_data);
|
||||
// TODO: Add guild name in message
|
||||
msg.reply(&ctx.http, format!("Submission channel set to <#{}>.", msg.channel_id)).await?;
|
||||
msg.reply(
|
||||
&ctx.http,
|
||||
format!("Submission channel set to <#{}>.", msg.channel_id),
|
||||
)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue