Skip to content

Commit

Permalink
fix gcode keyboard
Browse files Browse the repository at this point in the history
  • Loading branch information
nlef committed Jun 7, 2024
1 parent ff4146e commit 11b6893
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
15 changes: 5 additions & 10 deletions bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,10 @@ def check_unfinished_lapses(bot: telegram.Bot):
)
]
)
reply_markup = InlineKeyboardMarkup(files_keys)
bot.send_message(
configWrap.secrets.chat_id,
text="Unfinished timelapses found\nBuild unfinished timelapse?",
reply_markup=reply_markup,
reply_markup=InlineKeyboardMarkup(files_keys),
disable_notification=notifier.silent_status,
)

Expand Down Expand Up @@ -574,13 +573,12 @@ def print_file_dialog_handler(update: Update, context: CallbackContext) -> None:
),
]
]
reply_markup = InlineKeyboardMarkup(keyboard)
start_pre_mess = "Start printing file:"
message, bio = klippy.get_file_info_by_name(pri_filename, f"{start_pre_mess}{pri_filename}?")
update.effective_message.reply_to_message.reply_photo(
photo=bio,
caption=message,
reply_markup=reply_markup,
reply_markup=InlineKeyboardMarkup(keyboard),
disable_notification=notifier.silent_commands,
quote=True,
caption_entities=[MessageEntity(type="bold", offset=len(start_pre_mess), length=len(pri_filename))],
Expand Down Expand Up @@ -830,11 +828,10 @@ def get_macros(update: Update, _: CallbackContext) -> None:
klippy.macros,
)
)
reply_markup = InlineKeyboardMarkup(files_keys)

update.effective_message.reply_text(
"Gcode macros:",
reply_markup=reply_markup,
reply_markup=InlineKeyboardMarkup(files_keys),
disable_notification=notifier.silent_commands,
quote=True,
)
Expand Down Expand Up @@ -963,11 +960,10 @@ def upload_file(update: Update, _: CallbackContext) -> None:
),
]
]
reply_markup = InlineKeyboardMarkup(keyboard)
update.effective_message.reply_photo(
photo=thumb,
caption=mess,
reply_markup=reply_markup,
reply_markup=InlineKeyboardMarkup(keyboard),
disable_notification=notifier.silent_commands,
quote=True,
caption_entities=[MessageEntity(type="bold", offset=len(start_pre_mess), length=len(f"{configWrap.bot_config.formatted_upload_path}{sending_bio.name}"))],
Expand Down Expand Up @@ -1082,12 +1078,11 @@ def greeting_message(bot: telegram.Bot) -> None:
if configWrap.configuration_errors:
mess += escape(klippy.get_versions_info(bot_only=True)) + configWrap.configuration_errors

reply_markup = ReplyKeyboardMarkup(create_keyboard(), resize_keyboard=True)
bot.send_message(
configWrap.secrets.chat_id,
text=mess,
parse_mode=PARSEMODE_HTML,
reply_markup=reply_markup,
reply_markup=ReplyKeyboardMarkup(create_keyboard(), resize_keyboard=True),
disable_notification=notifier.silent_status,
)
bot.set_my_commands(commands=prepare_commands_list(klippy.macros, configWrap.telegram_ui.include_macros_in_command_list))
Expand Down
4 changes: 2 additions & 2 deletions bot/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Dict, List, Optional, Union

from apscheduler.schedulers.base import BaseScheduler # type: ignore
from telegram import Bot, ChatAction, InlineKeyboardButton, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, Message
from telegram import Bot, ChatAction, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo, Message
from telegram.constants import PARSEMODE_MARKDOWN_V2
from telegram.error import BadRequest
from telegram.utils.helpers import escape_markdown
Expand Down Expand Up @@ -663,6 +663,6 @@ def parse_button(mess: str):
self._bot.send_message(
self._chat_id,
text=title,
reply_markup=keyboard,
reply_markup=InlineKeyboardMarkup(keyboard),
disable_notification=self._silent_commands,
)
4 changes: 2 additions & 2 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
emoji==2.11.1
emoji==2.12.1
orjson==3.10.3
Pillow==10.3.0
PySocks==1.7.1
python-telegram-bot==13.15
rel==0.4.9.19
requests==2.31.0
requests==2.32.3
tzlocal==2.1
websocket-client==1.8.0
wsaccel==0.6.6

0 comments on commit 11b6893

Please sign in to comment.