|
15 | 15 | import pydub
|
16 | 16 | import threading
|
17 | 17 | import traceback
|
| 18 | +import base64 |
18 | 19 | from . import db, speech
|
19 | 20 | from .whitelisthandler import WhitelistHandler
|
20 | 21 | from channel import EFBChannel, EFBMsg, MsgType, MsgSource, TargetType, ChannelType
|
@@ -595,7 +596,7 @@ def link_chat_confirm(self, bot, tg_chat_id, tg_msg_id, callback_uid):
|
595 | 596 | txt += "\nWhat would you like to do?"
|
596 | 597 |
|
597 | 598 | link_url = "https://telegram.me/%s?startgroup=%s" % (
|
598 |
| - self.me.username, urllib.parse.quote("%s.%s" % (tg_chat_id, tg_msg_id))) |
| 599 | + self.me.username, urllib.parse.quote(self.b64en("%s.%s" % (tg_chat_id, tg_msg_id)))) |
599 | 600 | self.logger.debug("Telegram start trigger for linking chat: %s", link_url)
|
600 | 601 | if linked:
|
601 | 602 | btn_list = [telegram.InlineKeyboardButton("Relink", url=link_url),
|
@@ -974,7 +975,7 @@ def msg(self, bot, update):
|
974 | 975 | elif mtype == TGMsgType.Audio:
|
975 | 976 | m.type = MsgType.Audio
|
976 | 977 | m.text = "%s - %s\n%s" % (
|
977 |
| - update.message.audio.title, update.message.audio.perfomer, update.message.caption) |
| 978 | + update.message.audio.title, update.message.audio.performer, update.message.caption) |
978 | 979 | m.path, m.mime = self._download_file(update.message, update.message.audio, m.type)
|
979 | 980 | elif mtype == TGMsgType.Voice:
|
980 | 981 | m.type = MsgType.Audio
|
@@ -1065,7 +1066,10 @@ def start(self, bot, update, args=[]):
|
1065 | 1066 | args: Arguments from message
|
1066 | 1067 | """
|
1067 | 1068 | if update.message.from_user.id != update.message.chat.id: # from group
|
1068 |
| - data = self.msg_storage[args[0]] |
| 1069 | + try: |
| 1070 | + data = self.msg_storage[self.b64de(args[0])] |
| 1071 | + except KeyError: |
| 1072 | + update.message.reply_text("Session expired or unknown parameter. (SE02)") |
1069 | 1073 | chat_uid = data["chat_uid"]
|
1070 | 1074 | chat_display_name = data["chat_display_name"]
|
1071 | 1075 | slave_channel, slave_chat_uid = chat_uid.split('.', 1)
|
@@ -1267,3 +1271,10 @@ def stop_polling(self, val):
|
1267 | 1271 | self.queue.put(None)
|
1268 | 1272 | self._stop_polling = val
|
1269 | 1273 |
|
| 1274 | + @staticmethod |
| 1275 | + def b64en(s): |
| 1276 | + return base64.b64encode(s.encode()).decode() |
| 1277 | + |
| 1278 | + @staticmethod |
| 1279 | + def b64de(s): |
| 1280 | + return base64.b64decode(s).decode() |
0 commit comments