mirror of
https://github.com/Steffo99/greed.git
synced 2024-11-28 00:24:19 +00:00
variable start_point of worker
This commit is contained in:
parent
94f8b91611
commit
da222deffb
1 changed files with 6 additions and 0 deletions
|
@ -52,6 +52,8 @@ class Worker(threading.Thread):
|
||||||
self.telegram_user: telegram.User = telegram_user
|
self.telegram_user: telegram.User = telegram_user
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
self.loc = None
|
self.loc = None
|
||||||
|
# Let define start point from outside
|
||||||
|
self.start_point = None
|
||||||
# Open a new database session
|
# Open a new database session
|
||||||
log.debug(f"Opening new database session for {self.name}")
|
log.debug(f"Opening new database session for {self.name}")
|
||||||
self.session = sqlalchemy.orm.sessionmaker(bind=engine)()
|
self.session = sqlalchemy.orm.sessionmaker(bind=engine)()
|
||||||
|
@ -195,6 +197,10 @@ class Worker(threading.Thread):
|
||||||
# Capture exceptions that occour during the conversation
|
# Capture exceptions that occour during the conversation
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
|
# Go to start point if exists
|
||||||
|
if self.start_point:
|
||||||
|
self.start_point()
|
||||||
|
return
|
||||||
# Welcome the user to the bot
|
# Welcome the user to the bot
|
||||||
if self.cfg["Appearance"]["display_welcome_message"] == "yes":
|
if self.cfg["Appearance"]["display_welcome_message"] == "yes":
|
||||||
self.bot.send_message(self.chat.id, self.loc.get("conversation_after_start"))
|
self.bot.send_message(self.chat.id, self.loc.get("conversation_after_start"))
|
||||||
|
|
Loading…
Reference in a new issue