Skip to content

Commit

Permalink
fix: Regex & Env variable
Browse files Browse the repository at this point in the history
* change version to 3.3.1
* replace DATABASE_URL with DB_URI
* added webdriver config for debian default
* fix lens regex
  • Loading branch information
Jisan09 committed May 29, 2023
1 parent a572067 commit fdd55da
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
command: python3 -m userbot
restart: on-failure
environment:
- DATABASE_URL=postgresql://postgres:postgres@db/catuserbot
- DB_URI=postgresql://postgres:postgres@db/catuserbot
depends_on:
- db

Expand Down
6 changes: 5 additions & 1 deletion exampleconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ class Development(Config):
# External plugins repo
EXTERNAL_REPO = "https://github.com/TgCatUB/CatPlugins"
# if you need badcat plugins set "True"
BADCAT = "False"
BADCAT = "False"
# default set for debian, change if you are using other
# https://docs.catuserbot.co/catuserbot/installation/guide/chromium-and-chrome-driver-setup
CHROME_BIN = "/usr/bin/chromium"
CHROME_DRIVER = "/usr/bin/chromedriver"
2 changes: 1 addition & 1 deletion sample_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Config(object):
APP_ID = int(os.environ.get("APP_ID", 6))
API_HASH = os.environ.get("API_HASH") or None
# Datbase url heroku sets it automatically else get this from elephantsql
DB_URI = os.environ.get("DATABASE_URL", None)
DB_URI = os.environ.get("DB_URI", None)
# Get this value by running python3 stringsetup.py or https://repl.it/@sandeep1709/generatestringsession
STRING_SESSION = os.environ.get("STRING_SESSION", None)
# Telegram BOT Token and bot username from @BotFather
Expand Down
8 changes: 3 additions & 5 deletions userbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import sys
import time

import heroku3

from .Config import Config
from .core.logger import logging
from .core.session import catub
Expand All @@ -21,7 +19,7 @@
from .helpers.utils.utils import runasync
from .sql_helper.globals import addgvar, delgvar, gvarstatus

__version__ = "3.3.0"
__version__ = "3.3.1"
__license__ = "GNU Affero General Public License v3.0"
__author__ = "CatUserBot <https://github.com/TgCatUB/catuserbot>"
__copyright__ = f"Copyright (C) 2020 - 2023 {__author__}"
Expand All @@ -32,8 +30,6 @@
bot = catub

StartTime = time.time()
catversion = "3.3.0"


def close_connection(*_):
print("Closing Userbot connection.")
Expand Down Expand Up @@ -69,6 +65,8 @@ def close_connection(*_):
Config.PM_LOGGER_GROUP_ID = int(f"-{str(Config.PM_LOGGER_GROUP_ID)}")

try:
import heroku3

if Config.HEROKU_API_KEY is not None or Config.HEROKU_APP_NAME is not None:
HEROKU_APP = heroku3.from_key(Config.HEROKU_API_KEY).apps()[
Config.HEROKU_APP_NAME
Expand Down
2 changes: 1 addition & 1 deletion userbot/helpers/google_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def reverse_data(image_filename, flag=False):
if flag:
data["image_set"] = set()
for link in re.findall(
r"https://www.google.com/imgres\?imgurl.+?(?=\")", html
r"https://www.google.com/imgres\?[^\"]+", html
):
image = re.search(r"imgurl=(.+?)&", link)[1]
site = re.search(r"imgrefurl=(.+?)&", link)[1]
Expand Down
5 changes: 3 additions & 2 deletions userbot/plugins/alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import random
import re
import time
import userbot
from datetime import datetime
from platform import python_version

Expand Down Expand Up @@ -69,7 +70,7 @@ async def amireallyalive(event):
mention=mention,
uptime=uptime,
telever=version.__version__,
catver=catversion,
catver=userbot.__version__,
pyver=python_version(),
dbhealth=check_sgnirts,
ping=ms,
Expand Down Expand Up @@ -107,7 +108,7 @@ def catalive_text():
EMOJI = gvarstatus("ALIVE_EMOJI") or " ✥ "
cat_caption = "**Catuserbot is Up and Running**\n"
cat_caption += f"**{EMOJI} Telethon version :** `{version.__version__}\n`"
cat_caption += f"**{EMOJI} Catuserbot Version :** `{catversion}`\n"
cat_caption += f"**{EMOJI} Catuserbot Version :** `{userbot.__version__}`\n"
cat_caption += f"**{EMOJI} Python Version :** `{python_version()}\n`"
cat_caption += f"**{EMOJI} Master:** {mention}\n"
return cat_caption
Expand Down

0 comments on commit fdd55da

Please sign in to comment.