diff --git a/__pycache__/api.cpython-312.pyc b/__pycache__/api.cpython-312.pyc new file mode 100644 index 0000000..0093b99 Binary files /dev/null and b/__pycache__/api.cpython-312.pyc differ diff --git a/__pycache__/creds.cpython-312.pyc b/__pycache__/creds.cpython-312.pyc new file mode 100644 index 0000000..d9af3af Binary files /dev/null and b/__pycache__/creds.cpython-312.pyc differ diff --git a/api.py b/api.py index eeea09b..e53320f 100644 --- a/api.py +++ b/api.py @@ -1,12 +1,13 @@ from google_images_search import GoogleImagesSearch import creds +from creds import gimgsettings gis = GoogleImagesSearch(creds.api, creds.cx) def get_img(query, count): gis.search(search_params= { 'q': query, - 'safe': 'active', + 'safe': gimgsettings['safesearch'], 'num': count, }) if count == 1: diff --git a/creds.py b/creds.py index 8e2518e..70ce03c 100644 --- a/creds.py +++ b/creds.py @@ -2,4 +2,10 @@ bot = "" # bot api-key from next api = "" # google api key cx = "" # google cx -# tutorial for api&cx - https://pypi.org/project/Google-Images-Search/ \ No newline at end of file +gimgsettings = { + "usestoplist": True, # use stop-list + "stoplist": ["пенис", "хуй", "шлюха", "penis", "pride", 'lgbt', "лгбт", "прайд", "dick", "1488", "swastika", "свастика", "свастон"], + "safesearch": "high" # safe search mode. values: active|high|medium|off|safeUndefined +} + +# tutorial for api & cx - https://pypi.org/project/Google-Images-Search/ \ No newline at end of file diff --git a/main.py b/main.py index 0e57523..63a1bbe 100644 --- a/main.py +++ b/main.py @@ -2,14 +2,10 @@ import asyncio import aiohttp import next import creds +from creds import gimgsettings from next.ext import commands from api import get_img -gimgsettings = { - "usestoplist": True, - "stoplist": ["пенис", "хуй", "шлюха", "penis", "pride", 'lgbt', "лгбт", "прайд", "dick", "1488", "swastika", "свастика", "свастон"] -} - class Client(commands.CommandsClient): async def get_prefix(self, message: next.Message): return "!" @@ -38,7 +34,7 @@ class Client(commands.CommandsClient): arg += f"{word} " - if count>10: + if count > 10: toomanyimages = True else: toomanyimages = False @@ -58,7 +54,7 @@ class Client(commands.CommandsClient): async def main(): async with aiohttp.ClientSession() as session: client = Client(session, creds.bot) - print("Running GIMG") + print("Running GImages") await client.start() asyncio.run(main())