Skip to content

Commit

Permalink
Reverted changes regarding self._user, fixed validate_token=False cau…
Browse files Browse the repository at this point in the history
…sing error when extracting a bot id
  • Loading branch information
coder2020official committed Jul 28, 2024
1 parent 2dbf190 commit b10e8d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 1 addition & 5 deletions telebot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ def __init__(

if validate_token:
util.validate_token(self.token)

self.bot_id = util.extract_bot_id(self.token) # subject to change in future, unspecified
self.bot_id = util.extract_bot_id(self.token) # subject to change in future, unspecified

# logs-related
if colorful_logs:
Expand Down Expand Up @@ -1184,9 +1183,6 @@ def polling(self, non_stop: Optional[bool]=False, skip_pending: Optional[bool]=F
if restart_on_change:
self._setup_change_detector(path_to_watch)

if not self._user:
self._user = self.get_me()

logger.info('Starting your bot with username: [@%s]', self.user.username)

if self.threaded:
Expand Down
6 changes: 2 additions & 4 deletions telebot/async_telebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ def __init__(self, token: str, parse_mode: Optional[str]=None, offset: Optional[

if validate_token:
util.validate_token(self.token)

self.bot_id: int = util.extract_bot_id(self.token) # subject to change, unspecified
self.bot_id: int = util.extract_bot_id(self.token) # subject to change, unspecified


@property
Expand Down Expand Up @@ -437,8 +436,7 @@ async def _process_polling(self, non_stop: bool=False, interval: int=0, timeout:
# show warning
logger.warning("Setting non_stop to False will stop polling on API and system exceptions.")

if not self._user:
self._user = await self.get_me()
self._user = await self.get_me()

logger.info('Starting your bot with username: [@%s]', self.user.username)

Expand Down

0 comments on commit b10e8d7

Please sign in to comment.