Use post request for better use

Signed-off-by: Yasir Aris M <git@yasirdev.my.id>
This commit is contained in:
Yasir Aris M 2024-05-13 18:41:44 +07:00 committed by GitHub
parent 1bc29d25c6
commit 16e4f58f4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,8 +36,11 @@ async def gemini_chatbot(_, ctx: Message, strings):
return await ctx.reply_msg("GOOGLEAI_KEY env is missing!!!") return await ctx.reply_msg("GOOGLEAI_KEY env is missing!!!")
msg = await ctx.reply_msg(strings("find_answers_str"), quote=True) msg = await ctx.reply_msg(strings("find_answers_str"), quote=True)
try: try:
response = await fetch.get( data = {
f'https://yasirapi.eu.org/gemini?query={ctx.text.split(maxsplit=1)[1]}' "query": ctx.text.split(maxsplit=1)[1],
}
response = await fetch.post(
"https://yasirapi.eu.org/gemini", data=data
) )
if not response.json().get("candidates"): if not response.json().get("candidates"):
await ctx.reply_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.") await ctx.reply_msg("⚠️ Sorry, the prompt you sent maybe contains a forbidden word that is not permitted by AI.")