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 guild = msg.guild_id.unwrap().as_u64().to_string();
|
||||||
let current_guild_data = &guild_data[&guild].as_object().unwrap();
|
let current_guild_data = &guild_data[&guild].as_object().unwrap();
|
||||||
if !guild_data.contains_key(&guild) || !current_guild_data.contains_key("submissionChannel") {
|
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(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
let submission_channel = current_guild_data["submissionChannel"].as_str().unwrap();
|
let submission_channel = current_guild_data["submissionChannel"].as_str().unwrap();
|
||||||
if submission_channel != &msg.channel_id.as_u64().to_string() {
|
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(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if msg.attachments.len() == 0 {
|
if msg.attachments.len() == 0 {
|
||||||
|
|
|
@ -2,9 +2,9 @@ use serenity::framework::standard::{macros::command, CommandResult};
|
||||||
use serenity::model::prelude::*;
|
use serenity::model::prelude::*;
|
||||||
use serenity::prelude::*;
|
use serenity::prelude::*;
|
||||||
|
|
||||||
|
use serde_json::json;
|
||||||
use serde_json::Map;
|
use serde_json::Map;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use serde_json::json;
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
|
@ -83,12 +83,14 @@ async fn setSubmissionChannel(ctx: &Context, msg: &Message) -> CommandResult {
|
||||||
}
|
}
|
||||||
guild_data[&guild] = current_guild_data.into();
|
guild_data[&guild] = current_guild_data.into();
|
||||||
} else {
|
} else {
|
||||||
guild_data.insert(guild, json!({
|
guild_data.insert(guild, json!({ "submissionChannel": channel }));
|
||||||
"submissionChannel": channel
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
set_guild_data(guild_data);
|
set_guild_data(guild_data);
|
||||||
// TODO: Add guild name in message
|
// 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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue