add error handling to status command

This commit is contained in:
Micha Albert 2025-02-24 06:50:47 -05:00
parent 25ad994ec0
commit 34a240ff9b
No known key found for this signature in database

View file

@ -643,7 +643,7 @@ async def status_command(ack: AsyncAck, command):
await ack() await ack()
user_id = command["user_id"] user_id = command["user_id"]
channel_id = command["channel_id"] channel_id = command["channel_id"]
text = command["text"] try:
db_user = await db.user.find_first_or_raise(where={"slack_id": user_id}) db_user = await db.user.find_first_or_raise(where={"slack_id": user_id})
user_stream_key = ( user_stream_key = (
await db.stream.find_first_or_raise(where={"user_id": db_user.id}) await db.stream.find_first_or_raise(where={"user_id": db_user.id})
@ -672,7 +672,12 @@ async def status_command(ack: AsyncAck, command):
user=user_id, user=user_id,
text=f"The server currently thinks you are {"live" if user_stream_key in [stream for stream in active_streams] else "not live"}! It looks like you've streamed for a total of {total_streamed} minutes. Here are all of your recordings: ```{all_recs}```" text=f"The server currently thinks you are {"live" if user_stream_key in [stream for stream in active_streams] else "not live"}! It looks like you've streamed for a total of {total_streamed} minutes. Here are all of your recordings: ```{all_recs}```"
) )
except Exception:
await bolt.client.chat_postEphemeral(
channel=channel_id,
user=user_id,
text=f"There was an error processing your request! Are you signed up for OnBoard Live yet? Message <@U05C64XMMHV> if this looks like a mistake!"
)
@bolt.command("/onboard-live-submit") @bolt.command("/onboard-live-submit")
async def submit(ack: AsyncAck, command): async def submit(ack: AsyncAck, command):