mirror of
https://github.com/paul-nameless/tg
synced 2025-02-16 10:38:23 +00:00
Expand user when getting file path (#133)
This commit is contained in:
parent
111685170c
commit
f838f91bfe
1 changed files with 8 additions and 8 deletions
|
@ -12,7 +12,7 @@ from telegram.utils import AsyncResult
|
|||
from tg import config
|
||||
from tg.models import Model
|
||||
from tg.msg import MsgProxy
|
||||
from tg.tdlib import ChatAction, Tdlib, UserStatus
|
||||
from tg.tdlib import ChatAction, Tdlib
|
||||
from tg.utils import (
|
||||
get_duration,
|
||||
get_video_resolution,
|
||||
|
@ -335,13 +335,13 @@ class Controller:
|
|||
def send_file(
|
||||
self, send_file_fun: Callable[[str, int], AsyncResult],
|
||||
) -> None:
|
||||
file_path = self.view.status.get_input()
|
||||
if file_path and os.path.isfile(file_path):
|
||||
if chat_id := self.model.chats.id_by_index(
|
||||
self.model.current_chat
|
||||
):
|
||||
send_file_fun(file_path, chat_id)
|
||||
self.present_info("File sent")
|
||||
file_path = os.path.expanduser(self.view.status.get_input())
|
||||
if not file_path or not os.path.isfile(file_path):
|
||||
return self.present_info("Given path to file does not exist")
|
||||
|
||||
if chat_id := self.model.chats.id_by_index(self.model.current_chat):
|
||||
send_file_fun(file_path, chat_id)
|
||||
self.present_info("File sent")
|
||||
|
||||
@bind(msg_handler, ["v"])
|
||||
def record_voice(self) -> None:
|
||||
|
|
Loading…
Add table
Reference in a new issue