Skip to content

Commit 27f9562

Browse files
committed
Revert "Added vCard field to Contact"
This reverts commit 04f8433.
1 parent b929f57 commit 27f9562

File tree

8 files changed

+5
-44
lines changed

8 files changed

+5
-44
lines changed

telegram/bot.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,6 @@ def send_contact(self,
11011101
phone_number=None,
11021102
first_name=None,
11031103
last_name=None,
1104-
vcard=None,
11051104
disable_notification=False,
11061105
reply_to_message_id=None,
11071106
reply_markup=None,
@@ -1120,8 +1119,6 @@ def send_contact(self,
11201119
phone_number (:obj:`str`, optional): Contact's phone number.
11211120
first_name (:obj:`str`, optional): Contact's first name.
11221121
last_name (:obj:`str`, optional): Contact's last name.
1123-
vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard,
1124-
0-2048 bytes
11251122
contact (:class:`telegram.Contact`, optional): The contact to send.
11261123
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
11271124
receive a notification with no sound.
@@ -1152,14 +1149,11 @@ def send_contact(self,
11521149
phone_number = contact.phone_number
11531150
first_name = contact.first_name
11541151
last_name = contact.last_name
1155-
vcard = contact.vcard
11561152

11571153
data = {'chat_id': chat_id, 'phone_number': phone_number, 'first_name': first_name}
11581154

11591155
if last_name:
11601156
data['last_name'] = last_name
1161-
if vcard:
1162-
data['vcard'] = vcard
11631157

11641158
return url, data
11651159

telegram/files/contact.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,23 @@ class Contact(TelegramObject):
2929
first_name (:obj:`str`): Contact's first name.
3030
last_name (:obj:`str`): Optional. Contact's last name.
3131
user_id (:obj:`int`): Optional. Contact's user identifier in Telegram.
32-
vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard
3332
3433
Args:
3534
phone_number (:obj:`str`): Contact's phone number.
3635
first_name (:obj:`str`): Contact's first name.
3736
last_name (:obj:`str`, optional): Contact's last name.
3837
user_id (:obj:`int`, optional): Contact's user identifier in Telegram.
39-
vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard
4038
**kwargs (:obj:`dict`): Arbitrary keyword arguments.
4139
4240
"""
4341

44-
def __init__(self, phone_number, first_name, last_name=None, user_id=None, vcard=None,
45-
**kwargs):
42+
def __init__(self, phone_number, first_name, last_name=None, user_id=None, **kwargs):
4643
# Required
4744
self.phone_number = str(phone_number)
4845
self.first_name = first_name
4946
# Optionals
5047
self.last_name = last_name
5148
self.user_id = user_id
52-
self.vcard = vcard
5349

5450
self._id_attrs = (self.phone_number,)
5551

telegram/inline/inlinequeryresultcontact.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ class InlineQueryResultContact(InlineQueryResult):
3333
phone_number (:obj:`str`): Contact's phone number.
3434
first_name (:obj:`str`): Contact's first name.
3535
last_name (:obj:`str`): Optional. Contact's last name.
36-
vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard,
37-
0-2048 bytes
3836
reply_markup (:class:`telegram.InlineKeyboardMarkup`): Optional. Inline keyboard attached
3937
to the message.
4038
input_message_content (:class:`telegram.InputMessageContent`): Optional. Content of the
@@ -48,8 +46,6 @@ class InlineQueryResultContact(InlineQueryResult):
4846
phone_number (:obj:`str`): Contact's phone number.
4947
first_name (:obj:`str`): Contact's first name.
5048
last_name (:obj:`str`, optional): Contact's last name.
51-
vcard :obj:`str`, optional): Additional data about the contact in the form of a vCard,
52-
0-2048 bytes
5349
reply_markup (:class:`telegram.InlineKeyboardMarkup`, optional): Inline keyboard attached
5450
to the message.
5551
input_message_content (:class:`telegram.InputMessageContent`, optional): Content of the
@@ -66,7 +62,6 @@ def __init__(self,
6662
phone_number,
6763
first_name,
6864
last_name=None,
69-
vcard=None,
7065
reply_markup=None,
7166
input_message_content=None,
7267
thumb_url=None,
@@ -81,8 +76,6 @@ def __init__(self,
8176
# Optionals
8277
if last_name:
8378
self.last_name = last_name
84-
if vcard:
85-
self.vcard = vcard
8679
if reply_markup:
8780
self.reply_markup = reply_markup
8881
if input_message_content:

telegram/inline/inputcontactmessagecontent.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,18 @@ class InputContactMessageContent(InputMessageContent):
2828
phone_number (:obj:`str`): Contact's phone number.
2929
first_name (:obj:`str`): Contact's first name.
3030
last_name (:obj:`str`): Optional. Contact's last name.
31-
vcard (:obj:`str`): Optional. Additional data about the contact in the form of a vCard,
32-
0-2048 bytes
3331
3432
Args:
3533
phone_number (:obj:`str`): Contact's phone number.
3634
first_name (:obj:`str`): Contact's first name.
3735
last_name (:obj:`str`, optional): Contact's last name.
38-
vcard (:obj:`str`, optional): Additional data about the contact in the form of a vCard,
39-
0-2048 bytes
4036
**kwargs (:obj:`dict`): Arbitrary keyword arguments.
4137
4238
"""
4339

44-
def __init__(self, phone_number, first_name, last_name=None, vcard=None, **kwargs):
40+
def __init__(self, phone_number, first_name, last_name=None, **kwargs):
4541
# Required
4642
self.phone_number = phone_number
4743
self.first_name = first_name
4844
# Optionals
4945
self.last_name = last_name
50-
self.vcard = vcard

tests/test_bot.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,13 @@ def test_send_contact(self, bot, chat_id):
137137
phone_number = '+11234567890'
138138
first_name = 'Leandro'
139139
last_name = 'Toledo'
140-
vcard = 'vCard'
141140
message = bot.send_contact(chat_id=chat_id, phone_number=phone_number,
142-
first_name=first_name, last_name=last_name, vcard=vcard)
141+
first_name=first_name, last_name=last_name)
143142

144143
assert message.contact
145144
assert message.contact.phone_number == phone_number
146145
assert message.contact.first_name == first_name
147146
assert message.contact.last_name == last_name
148-
assert message.contact.vcard == vcard
149147

150148
@pytest.mark.skipif(os.getenv('APPVEYOR'), reason='No game made for Appveyor bot (''yet)')
151149
@flaky(3, 1)

tests/test_contact.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class TestContact(object):
3333
first_name = 'Leandro'
3434
last_name = 'Toledo'
3535
user_id = 23
36-
vcard = 'vCard'
3736

3837
def test_de_json_required(self, bot):
3938
json_dict = {'phone_number': self.phone_number, 'first_name': self.first_name}
@@ -44,22 +43,19 @@ def test_de_json_required(self, bot):
4443

4544
def test_de_json_all(self, bot):
4645
json_dict = {'phone_number': self.phone_number, 'first_name': self.first_name,
47-
'last_name': self.last_name, 'user_id': self.user_id,
48-
'vcard': self.vcard}
46+
'last_name': self.last_name, 'user_id': self.user_id}
4947
contact = Contact.de_json(json_dict, bot)
5048

5149
assert contact.phone_number == self.phone_number
5250
assert contact.first_name == self.first_name
5351
assert contact.last_name == self.last_name
5452
assert contact.user_id == self.user_id
55-
assert contact.vcard == self.vcard
5653

5754
def test_send_with_contact(self, monkeypatch, bot, chat_id, contact):
5855
def test(_, url, data, **kwargs):
5956
phone = data['phone_number'] == contact.phone_number
6057
first = data['first_name'] == contact.first_name
6158
last = data['last_name'] == contact.last_name
62-
vcard = data['vcard'] == contact.vcard
6359
return phone and first and last
6460

6561
monkeypatch.setattr('telegram.utils.request.Request.post', test)
@@ -78,7 +74,6 @@ def test_to_dict(self, contact):
7874
assert contact_dict['first_name'] == contact.first_name
7975
assert contact_dict['last_name'] == contact.last_name
8076
assert contact_dict['user_id'] == contact.user_id
81-
assert contact_dict['vcard'] == contact.vcard
8277

8378
def test_equality(self):
8479
a = Contact(self.phone_number, self.first_name)

tests/test_inlinequeryresultcontact.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def inline_query_result_contact():
3030
TestInlineQueryResultContact.phone_number,
3131
TestInlineQueryResultContact.first_name,
3232
last_name=TestInlineQueryResultContact.last_name,
33-
vcard=TestInlineQueryResultContact.vcard,
3433
thumb_url=TestInlineQueryResultContact.thumb_url,
3534
thumb_width=TestInlineQueryResultContact.thumb_width,
3635
thumb_height=TestInlineQueryResultContact.thumb_height,
@@ -44,7 +43,6 @@ class TestInlineQueryResultContact(object):
4443
phone_number = 'phone_number'
4544
first_name = 'first_name'
4645
last_name = 'last_name'
47-
vcard = 'vCard'
4846
thumb_url = 'thumb url'
4947
thumb_width = 10
5048
thumb_height = 15
@@ -57,7 +55,6 @@ def test_expected_values(self, inline_query_result_contact):
5755
assert inline_query_result_contact.phone_number == self.phone_number
5856
assert inline_query_result_contact.first_name == self.first_name
5957
assert inline_query_result_contact.last_name == self.last_name
60-
assert inline_query_result_contact.vcard == self.vcard
6158
assert inline_query_result_contact.thumb_url == self.thumb_url
6259
assert inline_query_result_contact.thumb_width == self.thumb_width
6360
assert inline_query_result_contact.thumb_height == self.thumb_height
@@ -77,8 +74,6 @@ def test_to_dict(self, inline_query_result_contact):
7774
inline_query_result_contact.first_name)
7875
assert (inline_query_result_contact_dict['last_name'] ==
7976
inline_query_result_contact.last_name)
80-
assert (inline_query_result_contact_dict['vcard'] ==
81-
inline_query_result_contact.vcard)
8277
assert (inline_query_result_contact_dict['thumb_url'] ==
8378
inline_query_result_contact.thumb_url)
8479
assert (inline_query_result_contact_dict['thumb_width'] ==

tests/test_inputcontactmessagecontent.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,18 @@
2626
def input_contact_message_content():
2727
return InputContactMessageContent(TestInputContactMessageContent.phone_number,
2828
TestInputContactMessageContent.first_name,
29-
last_name=TestInputContactMessageContent.last_name,
30-
vcard=TestInputContactMessageContent.vCard)
29+
last_name=TestInputContactMessageContent.last_name)
3130

3231

3332
class TestInputContactMessageContent(object):
3433
phone_number = 'phone number'
3534
first_name = 'first name'
3635
last_name = 'last name'
37-
vCard = 'My vCard text'
3836

3937
def test_expected_values(self, input_contact_message_content):
4038
assert input_contact_message_content.first_name == self.first_name
4139
assert input_contact_message_content.phone_number == self.phone_number
4240
assert input_contact_message_content.last_name == self.last_name
43-
assert input_contact_message_content.vCard == self.vCard
4441

4542
def test_to_dict(self, input_contact_message_content):
4643
input_contact_message_content_dict = input_contact_message_content.to_dict()
@@ -52,5 +49,3 @@ def test_to_dict(self, input_contact_message_content):
5249
input_contact_message_content.first_name)
5350
assert (input_contact_message_content_dict['last_name'] ==
5451
input_contact_message_content.last_name)
55-
assert (input_contact_message_content_dict['vcard'] ==
56-
input_contact_message_content.vcard)

0 commit comments

Comments
 (0)