measmonysuon commited on
Commit
e48bfe4
1 Parent(s): f35c9d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -59,7 +59,7 @@ def update_user_points(user_chat_id, points):
59
  ON CONFLICT(user_chat_id) DO UPDATE SET points = points + ?
60
  ''', (user_chat_id, points, points))
61
  conn.commit()
62
- logger.info(f"User with user_chat_id {user_chat_id} had their points updated by {points}.")
63
 
64
  def notify_webhook(user_chat_id):
65
  """Notify the webhook server about the points update."""
@@ -112,9 +112,9 @@ def create_gradio_interface():
112
  document.addEventListener('DOMContentLoaded', function() {
113
  window.Telegram.WebApp.init();
114
  const urlParams = new URLSearchParams(window.location.search);
115
- const username = urlParams.get('username') || "Guest";
116
- window.Telegram.WebApp.setTitle(`Welcome, ${username}!`);
117
- document.getElementById('username-input').value = username; // Set hidden textbox with username
118
  });
119
  </script>
120
  <h3>Welcome! Generate images based on prompts.</h3>
@@ -134,7 +134,7 @@ def create_gradio_interface():
134
  points_output = gr.Textbox(label="User Points", placeholder="User points will be displayed here", interactive=False)
135
 
136
  # Hidden textbox to hold the user_chat_id
137
- user_chat_id_input = gr.Textbox(visible=False, value="Guest", elem_id="username-input")
138
 
139
  # Set up interaction
140
  generate_button.click(
 
59
  ON CONFLICT(user_chat_id) DO UPDATE SET points = points + ?
60
  ''', (user_chat_id, points, points))
61
  conn.commit()
62
+ logger.info(f"User with ID {user_chat_id} had their points updated by {points}.")
63
 
64
  def notify_webhook(user_chat_id):
65
  """Notify the webhook server about the points update."""
 
112
  document.addEventListener('DOMContentLoaded', function() {
113
  window.Telegram.WebApp.init();
114
  const urlParams = new URLSearchParams(window.location.search);
115
+ const userChatId = urlParams.get('user_chat_id') || "Guest";
116
+ window.Telegram.WebApp.setTitle(`Welcome!`);
117
+ document.getElementById('user-chat-id-input').value = userChatId; // Set hidden textbox with userChatId
118
  });
119
  </script>
120
  <h3>Welcome! Generate images based on prompts.</h3>
 
134
  points_output = gr.Textbox(label="User Points", placeholder="User points will be displayed here", interactive=False)
135
 
136
  # Hidden textbox to hold the user_chat_id
137
+ user_chat_id_input = gr.Textbox(visible=False, value="Guest", elem_id="user-chat-id-input")
138
 
139
  # Set up interaction
140
  generate_button.click(