[Route] GET /guilds/:id/vanity-url
This commit is contained in:
		
							parent
							
								
									e5f731ba97
								
							
						
					
					
						commit
						d44d97d493
					
				| @ -82,4 +82,15 @@ router.post("/delete", async (req: Request, res: Response) => { | |||||||
| 	return res.sendStatus(204); | 	return res.sendStatus(204); | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | router.get("/vanity-url", async (req: Request, res: Response) => { | ||||||
|  | 	const { guild_id } = req.params; | ||||||
|  | 
 | ||||||
|  | 	const guild = await GuildModel.findOne({ id: guild_id }).exec(); | ||||||
|  | 	if (!guild) throw new HTTPError("Guild does not exist", 404); | ||||||
|  | 
 | ||||||
|  | 	if(!guild.vanity_url_code) throw new HTTPError("This guild has no vanity url", 204) | ||||||
|  | 
 | ||||||
|  | 	return res.json(guild.vanity_url_code); | ||||||
|  | }); | ||||||
|  | 
 | ||||||
| export default router; | export default router; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Intevel ツ
						Intevel ツ