Fix setSuggestionChannel panicking when key not in guilds.json

late-submissions
Elnu 3 years ago
parent 830ac6cb61
commit e8a29a2461

@ -63,7 +63,11 @@ async fn setSubmissionChannel(ctx: &Context, msg: &Message) -> CommandResult {
async fn setSuggestionChannel(ctx: &Context, msg: &Message) -> CommandResult {
let channel = msg.channel_id.as_u64().to_string();
let mut guild_data = get_guild_data();
if guild_data.contains_key("submissionChannel") {
guild_data["suggestionChannel"] = channel.into();
} else {
guild_data.insert(String::from("suggestionChannel"), channel.into());
}
set_guild_data(guild_data);
msg.reply(
&ctx.http,

Loading…
Cancel
Save