Skip to content

Commit

Permalink
Fix settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Brugger committed Sep 11, 2023
1 parent 945f9ef commit eddfda5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/telegram/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ async def settings(
user = await SQLiteUser().get_by_id(get_chat_id(telegram_object))
await overwrite_or_answer(
telegram_object,
messages.settings(user),
'Einstellungen:',
reply_markup=keyboards.settings(user)
)

Expand Down
27 changes: 10 additions & 17 deletions src/telegram/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@


def start(user: UserModel) -> str:
return f'{settings(user)}\n' \
pages = ''
if user.search_mydealz:
pages += '\nmydealz.de'
if user.search_mindstar:
pages += '\nMindStar (mindfactory.de/Highlights/MindStar)'
if user.search_preisjaeger:
pages += '\npreisjaeger.at'

return f'Folgende Websites werden durchsucht:' \
f'{pages}\n\n' \
f'Nutze /{Commands.SETTINGS} zum anpassen\n\n' \
f'Folgende Suchbegriffe sind aktiv:'

Expand Down Expand Up @@ -157,22 +166,6 @@ def user_blacklisted() -> str:
return 'Du bist leider vom Bot blockiert worden. Tja. ¯\\_(ツ)_/¯'


def settings(user: UserModel) -> str:
pages = []
if user.search_mydealz:
pages.append('mydealz.de')
if user.search_mindstar:
pages.append('MindStar (mindfactory.de/Highlights/MindStar)')
if user.search_preisjaeger:
pages.append('preisjaeger.at')

message = 'Folgende Websites werden durchsucht:'
for page in pages:
message.join(f'\n + {page}')

return message


def broadcast_start() -> str:
return 'Was möchtest Du broadcasten?'

Expand Down

0 comments on commit eddfda5

Please sign in to comment.