Skip to content

Commit 6bc1c36

Browse files
committed
Some deprecation warnings, formal and typo fixes
1 parent 492919e commit 6bc1c36

File tree

2 files changed

+124
-29
lines changed

2 files changed

+124
-29
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)