diff --git a/chatbot/plugins/response.py b/chatbot/plugins/response.py index 9495ba2..4245857 100644 --- a/chatbot/plugins/response.py +++ b/chatbot/plugins/response.py @@ -1,9 +1,14 @@ -import aiohttp - -async def get_response(query): - async with aiohttp.ClientSession() as ses: - async with ses.post( - f'https://endpoint.mannu.me/?query={query}' - ) as resp: - answer = await resp.json() - return answer['response']['bot'] \ No newline at end of file + +from requests.exceptions import HTTPError +import requests + +url = "https://api.affiliateplus.xyz/api" + + +def chatbot(msg, ainame, onwer, userid): + base = f'{url}/chatbot?message={msg}&botname={ainame}&ownername={owner}&user={userid}' + response = requests.get(base) + response.raise_for_status() + jsonResponse = response.json() + message = (jsonResponse["message"]) + return message