diff --git a/divent/bot.py b/divent/bot.py index 34571ba..90fc49b 100644 --- a/divent/bot.py +++ b/divent/bot.py @@ -221,7 +221,10 @@ async def subscribe(entity_id: str): entity_id=guild.vanity_url_code or guild.id, ) - user = await client.get_or_fetch_user(int(entity_id)) + try: + user = await client.get_or_fetch_user(int(entity_id)) + except ValueError: + return redirect(url_for(".login")) if user and str(user.id) == entity_id: return await render_template( @@ -281,7 +284,10 @@ async def ical(entity_id: str): return calendar.serialize() - user = await client.get_or_fetch_user(int(entity_id)) + try: + user = await client.get_or_fetch_user(int(entity_id)) + except ValueError: + return redirect(url_for(".login")) if user: calendar = Calendar()