Skip to content
Merged

beta #63

Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class Config(object):
BOT_NAME = os.getenv("BOT_NAME", "LARA")
# your aassistants alive pic (optional)
BOT_PIC = os.getenv("BOT_PIC", "https://telegra.ph/file/4d93e5fa480b5e53d898f.jpg")
# bot username for bot
# bot username of bot
BOT_USERNAME = os.getenv("BOT_USERNAME")
# bot id of bot
BOT_ID = os.getenv("BOT_ID")
# token of your bot if you want to use assistant
TOKEN = os.getenv("TOKEN")
# ---------------------
Expand Down
64 changes: 23 additions & 41 deletions tronx/helpers/bots.py
Original file line number Diff line number Diff line change
@@ -1,76 +1,58 @@
from tronx.helpers.utils import mention_markdown

try:
from tronx import (
BOT_ID,
BOT_NAME,
BOT_USERNAME,
Config
)
except ImportError:
BOT_ID = Config.BOT_ID if Config.BOT_ID else None
BOT_NAME = Config.BOT_NAME if Config.BOT_NAME else None
BOT_USERNAME = Config.BOT_USERNAME if Config.BOT_USERNAME else None
from tronx import (
BOT_ID,
BOT_NAME,
BOT_USERNAME,
Config
)

from tronx.database.postgres import dv_sql as dv
from pyrogram.types import Message




# name of bot (1st priority to database variable)
def botname():
"""Get your bot name"""
var = dv.getdv("BOT_NAME")
var_data = var if bool(var) is True else Config.BOT_NAME
data = var_data if var_data else BOT_NAME
return data if data else None


# username of bot
def botusername():
"""Get your bot username"""
var = dv.getdv("BOT_USERNAME")
var_data = var if bool(var) is True else Config.BOT_USERNAME
data = var_data if var_data else BOT_USERNAME
return data if data else None


# mention of bot
def botmention():
return mention_markdown(botid(), botname()) if botid() and bname() else None
"""Get bot mention"""
return f"[{botname()}](tg://user?id={botid()})" if botid() and botname() else None


# id of bot
def botid():
"""Get your bots telegram id"""
var = dv.getdv("BOT_ID")
var_data = var if bool(var) is True else Config.BOT_ID
data = var_data if var_data else BOT_ID
return data if data else None



# bio of bot
def bot_bio(m: Message):
if bool(dv.getdv("BOT_BIO")):
msg = dv.getdv("BOT_BIO") + "\n\nCatagory: "
elif Config.BOT_BIO:
msg = Config.BOT_BIO + "\n\nCatagory: "
else:
msg = f"Hey {m.from_user.mention} my name is LARA and I am your assistant bot. I can help you in many ways . Just use the buttons below to get list of possible commands...And Other Functions.\n\nCatagory: "
return msg


"""Get your bots bio"""
msg = f"Hey {m.from_user.mention} my name is LARA and I am your assistant bot. I can help you in many ways . Just use the buttons below to get list of possible commands.\n\nCatagory: "
var = dv.getdv("BOT_BIO")
var_data = var + "\n\nCatagory: " if bool(var) else Config.BOT_BIO + "\n\nCatagory: "
data = var_data if var_data else msg
return data if data else None


# pic of bot
def bot_pic():
if bool(dv.getdv("BOT_PIC")):
_pic = dv.getdv("BOT_PIC")
elif Config.BOT_PIC:
_pic = Config.BOT_PIC
else:
_pic = False
return _pic

#End


"""Get your bot pic url"""
var = dv.getdv("BOT_PIC")
var_data = var if bool(var) else Config.BOT_PIC
data = var_data if bool(var_data) else False
return data if data else None

Loading