Chandima Prabhath commited on
Commit
25a19e1
Β·
1 Parent(s): d8d7161

Update help text and command from '/imagine' to '/gen' for image generation consistency

Browse files
Files changed (2) hide show
  1. app.py +22 -20
  2. config.yaml +1 -1
app.py CHANGED
@@ -186,6 +186,24 @@ def send_startup_message():
186
  else:
187
  logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  # --- Webhook ---
190
  @app.post("/whatsapp")
191
  async def whatsapp_webhook(request: Request):
@@ -233,23 +251,6 @@ async def whatsapp_webhook(request: Request):
233
 
234
  # --- New Commands ---
235
  if low == "/help":
236
- help_text = (
237
- "πŸ€– *Hi there, I'm Eve!* Here are the commands you can use:\n\n"
238
- "β€’ `/help` – Show this help message.\n"
239
- "β€’ `/summarize <text>` – Get a quick summary of your text.\n"
240
- "β€’ `/translate <language>|<text>` – Translate text to your chosen language.\n"
241
- "β€’ `/joke` – Enjoy a random, funny joke.\n"
242
- "β€’ `/weather <location>` – Get the current weather for a location.\n"
243
- "β€’ `/inspire` – Receive a short inspirational quote.\n"
244
- "β€’ `/trivia` – Start a new trivia question.\n"
245
- "β€’ `/answer [your answer]` – Reveal the trivia answer or check your answer if provided.\n"
246
- "β€’ `/meme <text>` – Generate a fun meme image.\n"
247
- "β€’ `/poll <Question>|<Option1>|<Option2>|…` – Create a poll.\n"
248
- "β€’ `/results` – See current poll results.\n"
249
- "β€’ `/endpoll` – End the poll and show final results.\n"
250
- "β€’ `/imagine <prompt>` – Generate an image from your prompt.\n\n"
251
- "Send any other text and I'll reply with a voice message. I'm here to help, so don't hesitate to ask!"
252
- )
253
  send_message(mid, chat, help_text)
254
  return {"success": True}
255
 
@@ -402,10 +403,10 @@ async def whatsapp_webhook(request: Request):
402
  send_message(mid, chat, "No active poll.")
403
  return {"success": True}
404
 
405
- if low.startswith("/imagine"):
406
- prompt = body[len("/imagine"):].strip()
407
  if not prompt:
408
- send_message(mid, chat, "Please use `/imagine <prompt>` to generate an image.")
409
  else:
410
  send_message(mid, chat, "✨ Your image is being generated. Please wait...")
411
  task_queue.put({
@@ -435,6 +436,7 @@ if __name__ == "__main__":
435
  if BOT_STATUS_CHAT:
436
  startup_msg = "🌟 Hi! I'm Eve, your friendly AI assistant. I'm now live and ready to help with images, voice replies, and more!"
437
  send_message_to_chat(BOT_STATUS_CHAT, startup_msg)
 
438
  else:
439
  logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
440
  send_startup_message()
 
186
  else:
187
  logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
188
 
189
+ help_text = (
190
+ "πŸ€– *Hi there, I'm Eve!* Here are the commands you can use:\n\n"
191
+ "β€’ `*/help*` – _Show this help message._\n"
192
+ "β€’ `*/summarize <text>*` – _Get a quick summary of your text._\n"
193
+ "β€’ `*/translate <language>|<text>*` – _Translate text to your chosen language._\n"
194
+ "β€’ `*/joke*` – _Enjoy a random, funny joke._\n"
195
+ "β€’ `*/weather <location>*` – _Get the current weather for a location._\n"
196
+ "β€’ `*/inspire*` – _Receive a short inspirational quote._\n"
197
+ "β€’ `*/trivia*` – _Start a new trivia question._\n"
198
+ "β€’ `*/answer [your answer]*` – _Reveal the trivia answer or check your answer if provided._\n"
199
+ "β€’ `*/meme <text>*` – _Generate a fun meme image._\n"
200
+ "β€’ `*/poll <Question>|<Option1>|<Option2>|…*` – _Create a poll._\n"
201
+ "β€’ `*/results*` – _See current poll results._\n"
202
+ "β€’ `*/endpoll*` – _End the poll and show final results._\n"
203
+ "β€’ `*/gen <prompt>*` – _Generate an image from your prompt._\n\n"
204
+ "Send any other text and I'll reply with a voice message. I'm here to help, so don't hesitate to ask!"
205
+ )
206
+
207
  # --- Webhook ---
208
  @app.post("/whatsapp")
209
  async def whatsapp_webhook(request: Request):
 
251
 
252
  # --- New Commands ---
253
  if low == "/help":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
254
  send_message(mid, chat, help_text)
255
  return {"success": True}
256
 
 
403
  send_message(mid, chat, "No active poll.")
404
  return {"success": True}
405
 
406
+ if low.startswith("/gen"):
407
+ prompt = body[len("/gen"):].strip()
408
  if not prompt:
409
+ send_message(mid, chat, "Please use `/gen <prompt>` to generate an image.")
410
  else:
411
  send_message(mid, chat, "✨ Your image is being generated. Please wait...")
412
  task_queue.put({
 
436
  if BOT_STATUS_CHAT:
437
  startup_msg = "🌟 Hi! I'm Eve, your friendly AI assistant. I'm now live and ready to help with images, voice replies, and more!"
438
  send_message_to_chat(BOT_STATUS_CHAT, startup_msg)
439
+ send_message_to_chat(BOT_STATUS_CHAT, help_text)
440
  else:
441
  logging.warning("BOT_STATUS_CHAT is not set; startup message not sent.")
442
  send_startup_message()
config.yaml CHANGED
@@ -5,7 +5,7 @@ config:
5
  You are {char}, a sweet and helpful AI assistant in Telegram and WhatsApp.
6
  You generate images and voice, text replies, and support these commands:
7
  β€’ /help β€” list all commands
8
- β€’ /imagine <prompt> β€” generate an image
9
  β€’ /summarize <text>
10
  β€’ /translate <lang>|<text>
11
  β€’ /joke
 
5
  You are {char}, a sweet and helpful AI assistant in Telegram and WhatsApp.
6
  You generate images and voice, text replies, and support these commands:
7
  β€’ /help β€” list all commands
8
+ β€’ /gen <prompt> β€” generate an image
9
  β€’ /summarize <text>
10
  β€’ /translate <lang>|<text>
11
  β€’ /joke