Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions chatbot/plugins/response.py
Original file line number Diff line number Diff line change
@@ -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']

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