Skip to content

Commit 6521721

Browse files
authored
Merge pull request #13
merge bugfix-db736f9 with master
2 parents db736f9 + c0c1235 commit 6521721

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

tgmb/__init__.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ def __init__(self, mirrorHelper: 'MirrorHelper'):
548548

549549
def addDownload(self, mirrorInfo: MirrorInfo):
550550
sourceId = mirrorInfo.googleDriveDownloadSourceId
551-
self.mirrorHelper.mirrorInfos[mirrorInfo.uid].sizeTotal = self.getSizeById(sourceId)
551+
self.mirrorHelper.mirrorInfos[mirrorInfo.uid].updateVars({mirrorInfo.updatableVars[0]:
552+
self.getSizeById(sourceId)})
552553
isFolder = False
553554
if self.getMetadataById(sourceId, 'mimeType') == self.googleDriveFolderMimeType:
554555
isFolder = True
@@ -763,7 +764,7 @@ def addDownload(self, mirrorInfo: MirrorInfo):
763764
replyTo = mirrorInfo.msg.reply_to_message
764765
for media in [replyTo.document, replyTo.audio, replyTo.video]:
765766
if media:
766-
self.mirrorHelper.mirrorInfos[mirrorInfo.uid].sizeTotal = media.file_size
767+
self.mirrorHelper.mirrorInfos[mirrorInfo.uid].updateVars({mirrorInfo.updatableVars[0]: media.file_size})
767768
self.downloadMedia(media, mirrorInfo.path)
768769
break
769770
self.mirrorHelper.mirrorListener.updateStatus(mirrorInfo.uid, MirrorStatus.downloadComplete)
@@ -930,7 +931,7 @@ def getMirrorStatusStr(self, uid: str):
930931
f'{getReadableSize(mirrorInfo.sizeTotal - mirrorInfo.sizeCurrent)}\n' \
931932
f'P: {getProgressBar(mirrorInfo.progressPercent)} | ' \
932933
f'{mirrorInfo.progressPercent}% | ' \
933-
f'{getReadableSize(mirrorInfo.speedCurrent / 8)}/s\n' \
934+
f'{getReadableSize(mirrorInfo.speedCurrent)}/s\n' \
934935
f'T: {getReadableTime(mirrorInfo.timeCurrent - mirrorInfo.timeStart)} | ' \
935936
f'{getReadableTime(mirrorInfo.timeEnd - mirrorInfo.timeCurrent)}\n'
936937
if mirrorInfo.isTorrent:

tgmb/botCmdHandler.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,9 @@ def topCallBack(update: telegram.Update, _: telegram.ext.CallbackContext):
136136

137137

138138
def unknownCallBack(update: telegram.Update, _: telegram.ext.CallbackContext):
139-
bot.sendMessage(text='Sorry, the command is not registered with a CommandHandler !', parse_mode='HTML',
140-
chat_id=update.message.chat_id, reply_to_message_id=update.message.message_id)
139+
if not '@' in update.message.text.split(' ')[0]:
140+
bot.sendMessage(text='Sorry, the command is not registered with a CommandHandler !', parse_mode='HTML',
141+
chat_id=update.message.chat_id, reply_to_message_id=update.message.message_id)
141142

142143

143144
def addHandlers(dispatcher: telegram.ext.Dispatcher):

0 commit comments

Comments
 (0)