You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
start_hour=st.number_input("Start Hour", min_value=0, max_value=23, value=8, step=1, help="Hour in 24-hour format (0-23)")
719
+
withcol2:
720
+
end_hour=st.number_input("End Hour", min_value=0, max_value=23, value=22, step=1, help="Hour in 24-hour format (0-23)")
721
+
722
+
submitted=st.form_submit_button("Add Alert")
723
+
724
+
ifsubmitted:
725
+
ifnotchat_id:
726
+
st.error("Please enter a Chat ID")
727
+
elifstart_hour>end_hour:
728
+
st.error("Start hour must be less than or equal to end hour")
729
+
else:
730
+
try:
731
+
# Store chat_id in session state
732
+
st.session_state['alert_chat_id'] =chat_id
733
+
734
+
# Insert subscription into Supabase
735
+
response=supabase.table('subscriptions').insert({
736
+
'chat_id': chat_id,
737
+
'day_of_week': day_of_week,
738
+
'start_hour': start_hour,
739
+
'end_hour': end_hour
740
+
}).execute()
741
+
742
+
st.success(f"✅ Alert added successfully!")
743
+
st.rerun()
744
+
exceptExceptionase:
745
+
st.error(f"Failed to add alert: {e}")
746
+
747
+
# Display current subscriptions
748
+
st.markdown("### My Alerts")
749
+
750
+
# Search box for Chat ID
751
+
col_search1, col_search2=st.columns([3, 1])
752
+
withcol_search1:
753
+
search_chat_id=st.text_input("Search by Chat ID", key="search_chat_id", placeholder="Enter your Telegram Chat ID", help="Enter your Chat ID to view and manage your alerts")
0 commit comments