mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
Ft ChatBot TG Business by Gemini AI
Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
parent
0db01eb099
commit
98e6e0ae2e
1 changed files with 7 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ __HELP__ = """
|
|||
|
||||
|
||||
@app.on_message(filters.command("ai", COMMAND_HANDLER) & pyro_cooldown.wait(10))
|
||||
@app.on_bot_business_message(filters.command("ai", COMMAND_HANDLER) & pyro_cooldown.wait(10))
|
||||
@use_chat_lang()
|
||||
async def gemini_chatbot(_, ctx: Message, strings):
|
||||
if len(ctx.command) == 1:
|
||||
|
|
@ -56,10 +57,13 @@ async def gemini_chatbot(_, ctx: Message, strings):
|
|||
timeout=20.0,
|
||||
)
|
||||
if not response.json().get("candidates"):
|
||||
return await msg.edit_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.")
|
||||
await msg.edit_msg(html.escape(response.json()["candidates"][0]["content"]["parts"][0]["text"]))
|
||||
await ctx.reply_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.")
|
||||
else:
|
||||
await ctx.reply_msg(html.escape(response.json()["candidates"][0]["content"]["parts"][0]["text"]))
|
||||
await msg.delete()
|
||||
except Exception as e:
|
||||
await msg.edit_msg(str(e))
|
||||
await ctx.reply_msg(str(e))
|
||||
await msg.delete()
|
||||
|
||||
|
||||
@app.on_message(filters.command("ask", COMMAND_HANDLER) & pyro_cooldown.wait(10))
|
||||
|
|
|
|||
Loading…
Reference in a new issue