mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-13 14:12:41 +01:00
Update welcome_screen.ts
This commit is contained in:
parent
8918103884
commit
643f0c9723
@ -28,7 +28,7 @@ router.post("/", check(GuildAddChannelToWelcomeScreenSchema), async (req: Reques
|
|||||||
...body
|
...body
|
||||||
}
|
}
|
||||||
|
|
||||||
if(guild.welcome_screen.welcome_channels.some(channel => channel.channel_id === body.channel_id)){
|
if(guild.welcome_screen.welcome_channels.some(channel => channel.channel_id === body.channel_id)) throw new Error("Welcome Channel exists")
|
||||||
|
|
||||||
|
|
||||||
await GuildModel.findOneAndUpdate(
|
await GuildModel.findOneAndUpdate(
|
||||||
@ -38,7 +38,7 @@ router.post("/", check(GuildAddChannelToWelcomeScreenSchema), async (req: Reques
|
|||||||
{ $push: { "welcome_screen.welcome_channels": channelObject } }
|
{ $push: { "welcome_screen.welcome_channels": channelObject } }
|
||||||
).exec();
|
).exec();
|
||||||
|
|
||||||
res.json(toObject(guild.welcome_screen));
|
res.sendStatus(204);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user