Skip to content

Commit

Permalink
Merge pull request #56 from kastaid/dev
Browse files Browse the repository at this point in the history
improve
  • Loading branch information
illvart authored Aug 10, 2023
2 parents 4226264 + 1bc9f48 commit 1dacc42
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 35 deletions.
6 changes: 2 additions & 4 deletions getter/core/db/gban_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ def is_gban(user_id, use_cache: bool = False):

def add_gban(user_id, date, reason=None):
with _GBAN_LOCK:
user_id = str(user_id)
SESSION.add(GBan(user_id, date, reason or ""))
SESSION.add(GBan(str(user_id), date, reason or ""))
SESSION.commit()


Expand All @@ -77,8 +76,7 @@ def del_gban(user_id):

def set_gban_reason(user_id, reason):
with _GBAN_LOCK:
user_id = str(user_id)
user = SESSION.query(GBan).get(user_id)
user = SESSION.query(GBan).get(str(user_id))
if not user:
return ""
prev_reason = user.reason
Expand Down
9 changes: 3 additions & 6 deletions getter/core/db/gdel_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,21 @@ def is_gdel(user_id, use_cache: bool = False):

def add_gdel(user_id, date, reason=None):
with _GDEL_LOCK:
user_id = str(user_id)
SESSION.add(GDel(user_id, date, reason or ""))
SESSION.add(GDel(str(user_id), date, reason or ""))
SESSION.commit()


def del_gdel(user_id):
with _GDEL_LOCK:
user_id = str(user_id)
user = SESSION.query(GDel).get(user_id)
user = SESSION.query(GDel).get(str(user_id))
if user:
SESSION.delete(user)
SESSION.commit()


def set_gdel_reason(user_id, reason):
with _GDEL_LOCK:
user_id = str(user_id)
user = SESSION.query(GDel).get(user_id)
user = SESSION.query(GDel).get(str(user_id))
if not user:
return ""
prev_reason = user.reason
Expand Down
9 changes: 3 additions & 6 deletions getter/core/db/gmute_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,21 @@ def is_gmute(user_id, use_cache: bool = False):

def add_gmute(user_id, date, reason=None):
with _GMUTE_LOCK:
user_id = str(user_id)
SESSION.add(GMute(user_id, date, reason or ""))
SESSION.add(GMute(str(user_id), date, reason or ""))
SESSION.commit()


def del_gmute(user_id):
with _GMUTE_LOCK:
user_id = str(user_id)
user = SESSION.query(GMute).get(user_id)
user = SESSION.query(GMute).get(str(user_id))
if user:
SESSION.delete(user)
SESSION.commit()


def set_gmute_reason(user_id, reason):
with _GMUTE_LOCK:
user_id = str(user_id)
user = SESSION.query(GMute).get(user_id)
user = SESSION.query(GMute).get(str(user_id))
if not user:
return ""
prev_reason = user.reason
Expand Down
6 changes: 2 additions & 4 deletions getter/core/db/pmpermit_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@ def is_allow(user_id, use_cache: bool = False):

def allow_user(user_id, date, reason=None):
with _PMPERMIT_LOCK:
user_id = str(user_id)
SESSION.add(PMPermit(user_id, date, reason or ""))
SESSION.add(PMPermit(str(user_id), date, reason or ""))
SESSION.commit()


def deny_user(user_id):
with _PMPERMIT_LOCK:
user_id = str(user_id)
user = SESSION.query(PMPermit).get(user_id)
user = SESSION.query(PMPermit).get(str(user_id))
if user:
SESSION.delete(user)
SESSION.commit()
Expand Down
12 changes: 3 additions & 9 deletions getter/core/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,12 @@ async def autous(user_id: int) -> None:
if Var.DEV_MODE and user_id in DEVS:
return
await getter_app.join_to(_c)
await asyncio.sleep(6)
await asyncio.sleep(5)
await getter_app.join_to(_u)
await asyncio.sleep(6)
await asyncio.sleep(5)
await getter_app.mute_chat(_u)
await asyncio.sleep(6)
await asyncio.sleep(5)
await getter_app.join_to(_g)
await asyncio.sleep(6)
await getter_app.mute_chat(_g)
await asyncio.sleep(6)
BOTLOGS = get_botlogs()
if BOTLOGS:
await getter_app.mute_chat(BOTLOGS)


async def finishing(launch_msg: str) -> None:
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ cryptg==0.4.0
pytz==2022.7
psutil==5.9.5
heroku3==5.2.1
GitPython==3.1.31
GitPython==3.1.32
psycopg2-binary==2.9.6
SQLAlchemy==1.4.48
sqlalchemy-json==0.5.0
cachetools==5.3.1
asyncache==0.3.1
aiofiles==23.1.0
aiofiles==23.2.1
aiocsv==1.2.4
async-timeout==4.0.2
aiohttp[speedups]==3.8.4
Markdown==3.4.3
aiohttp[speedups]==3.8.5
Markdown==3.4.4
beautifulsoup4==4.12.2
emoji==2.5.1
emoji==2.7.0
validators==0.20.0
telegraph==2.2.0
requests==2.31.0
lottie==0.7.0
Pillow==9.5.0
CairoSVG==2.7.0
CairoSVG==2.7.1
uvloop==0.17.0

0 comments on commit 1dacc42

Please sign in to comment.