Fix setSuggestionChannel panicking when key not in guilds.json
This commit is contained in:
parent
830ac6cb61
commit
e8a29a2461
1 changed files with 5 additions and 1 deletions
|
@ -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();
|
||||
guild_data["suggestionChannel"] = channel.into();
|
||||
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…
Add table
Reference in a new issue