Compare commits
1 Commits
main
...
profitroll
Author | SHA1 | Date | |
---|---|---|---|
1c7095a40b |
21
classes/api_client.py
Normal file
21
classes/api_client.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
from garbage_api_client import Client
|
||||||
|
from garbage_api_client.api.default.entry_find_locations_location_entries_get import (
|
||||||
|
asyncio as entry_find,
|
||||||
|
)
|
||||||
|
from garbage_api_client.api.default.location_find_locations_get import (
|
||||||
|
asyncio as location_find,
|
||||||
|
)
|
||||||
|
from garbage_api_client.api.default.location_get_locations_id_get import (
|
||||||
|
asyncio as location_get,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class APIClient(Client):
|
||||||
|
async def entry_find(self, *args, **kwargs):
|
||||||
|
await entry_find(client=self, *args, **kwargs)
|
||||||
|
|
||||||
|
async def location_find(self, *args, **kwargs):
|
||||||
|
await location_find(client=self, *args, **kwargs)
|
||||||
|
|
||||||
|
async def location_get(self, *args, **kwargs):
|
||||||
|
await location_get(client=self, *args, **kwargs)
|
@ -8,6 +8,7 @@ from libbot.pyrogram.classes import PyroClient as LibPyroClient
|
|||||||
from pymongo import ASCENDING, GEOSPHERE, TEXT
|
from pymongo import ASCENDING, GEOSPHERE, TEXT
|
||||||
from pyrogram.types import User
|
from pyrogram.types import User
|
||||||
|
|
||||||
|
from classes.api_client import APIClient
|
||||||
from classes.location import Location
|
from classes.location import Location
|
||||||
from classes.pyrouser import PyroUser
|
from classes.pyrouser import PyroUser
|
||||||
from classes.updater import Updater
|
from classes.updater import Updater
|
||||||
@ -25,6 +26,7 @@ class PyroClient(LibPyroClient):
|
|||||||
|
|
||||||
self.updater = Updater(ClientSession())
|
self.updater = Updater(ClientSession())
|
||||||
self.contexts = []
|
self.contexts = []
|
||||||
|
self.api_client = APIClient()
|
||||||
|
|
||||||
if self.scheduler is not None:
|
if self.scheduler is not None:
|
||||||
self.scheduler.add_job(
|
self.scheduler.add_job(
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
"max_concurrent_transmissions": 1,
|
"max_concurrent_transmissions": 1,
|
||||||
"scoped_commands": true
|
"scoped_commands": true
|
||||||
},
|
},
|
||||||
|
"api": {
|
||||||
|
"url": "https://api.garbagebot.eu"
|
||||||
|
},
|
||||||
"database": {
|
"database": {
|
||||||
"user": null,
|
"user": null,
|
||||||
"password": null,
|
"password": null,
|
||||||
@ -16,13 +19,6 @@
|
|||||||
"port": 27017,
|
"port": 27017,
|
||||||
"name": "garbage_bot"
|
"name": "garbage_bot"
|
||||||
},
|
},
|
||||||
"database_api": {
|
|
||||||
"user": null,
|
|
||||||
"password": null,
|
|
||||||
"host": "127.0.0.1",
|
|
||||||
"port": 27017,
|
|
||||||
"name": "garbage_reminder"
|
|
||||||
},
|
|
||||||
"search": {
|
"search": {
|
||||||
"radius": 0.1
|
"radius": 0.1
|
||||||
},
|
},
|
||||||
|
21
migrations/202405270030.py
Normal file
21
migrations/202405270030.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
from libbot import sync
|
||||||
|
from mongodb_migrations.base import BaseMigration
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(BaseMigration):
|
||||||
|
def upgrade(self):
|
||||||
|
sync.config_set("api", {"url": "https://api.garbagebot.eu"})
|
||||||
|
sync.config_delete("database_api", missing_ok=True)
|
||||||
|
|
||||||
|
def downgrade(self):
|
||||||
|
sync.config_delete("api", missing_ok=True)
|
||||||
|
sync.config_set(
|
||||||
|
"database_api",
|
||||||
|
{
|
||||||
|
"user": None,
|
||||||
|
"password": None,
|
||||||
|
"host": "127.0.0.1",
|
||||||
|
"port": 27017,
|
||||||
|
"name": "garbage_reminder",
|
||||||
|
},
|
||||||
|
)
|
@ -9,3 +9,5 @@ uvloop==0.19.0
|
|||||||
async_pymongo==0.1.4
|
async_pymongo==0.1.4
|
||||||
libbot[speed,pyrogram]==3.2.2
|
libbot[speed,pyrogram]==3.2.2
|
||||||
pykeyboard==0.1.7
|
pykeyboard==0.1.7
|
||||||
|
--extra-index-url https://git.end-play.xyz/api/packages/GarbageReminder/pypi/simple
|
||||||
|
garbageapi-client==0.1.0
|
Reference in New Issue
Block a user