Skip to content

Commit aabc0bf

Browse files
authored
Merge pull request #2505 from Badiboy/master
Some deprecation warnings, formal and typo fixes
2 parents c7b5358 + c01b904 commit aabc0bf

File tree

3 files changed

+228
-131
lines changed

3 files changed

+228
-131
lines changed

telebot/apihelper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ def _make_request(token, method_name, method='get', params=None, files=None):
168168
json_result = _check_result(method_name, result)
169169
if json_result:
170170
return json_result['result']
171+
else:
172+
return None
171173

172174

173175
def _check_result(method_name, result):
@@ -1139,8 +1141,10 @@ def send_data(token, chat_id, data, data_type, reply_markup=None, parse_mode=Non
11391141
def get_method_by_type(data_type):
11401142
if data_type == 'document':
11411143
return r'sendDocument'
1142-
if data_type == 'sticker':
1144+
elif data_type == 'sticker':
11431145
return r'sendSticker'
1146+
else:
1147+
raise ValueError(f"Unsupported data type: {data_type}.")
11441148

11451149

11461150
def ban_chat_member(token, chat_id, user_id, until_date=None, revoke_messages=None):
@@ -2524,6 +2528,7 @@ def convert_input_media_array(array):
25242528
for input_media in array:
25252529
if isinstance(input_media, types.InputMedia) or isinstance(input_media, types.InputPaidMedia):
25262530
media_dict = input_media.to_dict()
2531+
key = "x" # stub
25272532
if media_dict['media'].startswith('attach://'):
25282533
key = media_dict['media'].replace('attach://', '')
25292534
files[key] = input_media.media

0 commit comments

Comments
 (0)