mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
AIOG-T-92 Google Places as a venue API provider
This commit is contained in:
parent
f419692055
commit
5662d090b5
4 changed files with 97 additions and 45 deletions
|
|
@ -1115,44 +1115,72 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
|||
return result
|
||||
return types.Message(**result)
|
||||
|
||||
async def send_venue(self, chat_id: typing.Union[base.Integer, base.String],
|
||||
latitude: base.Float, longitude: base.Float,
|
||||
title: base.String, address: base.String,
|
||||
foursquare_id: typing.Union[base.String, None] = None,
|
||||
foursquare_type: typing.Union[base.String, None] = None,
|
||||
disable_notification: typing.Union[base.Boolean, None] = None,
|
||||
reply_to_message_id: typing.Union[base.Integer, None] = None,
|
||||
async def send_venue(self,
|
||||
chat_id: typing.Union[base.Integer, base.String],
|
||||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
title: base.String,
|
||||
address: base.String,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None,
|
||||
google_place_id: typing.Optional[base.String] = None,
|
||||
google_place_type: typing.Optional[base.String] = None,
|
||||
disable_notification: typing.Optional[base.Boolean] = None,
|
||||
reply_to_message_id: typing.Optional[base.Integer] = None,
|
||||
reply_markup: typing.Union[types.InlineKeyboardMarkup,
|
||||
types.ReplyKeyboardMarkup,
|
||||
types.ReplyKeyboardRemove,
|
||||
types.ForceReply, None] = None) -> types.Message:
|
||||
types.ForceReply, None] = None,
|
||||
) -> types.Message:
|
||||
"""
|
||||
Use this method to send information about a venue.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#sendvenue
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel
|
||||
:param chat_id: Unique identifier for the target chat or username of the
|
||||
target channel (in the format @channelusername)
|
||||
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
|
||||
|
||||
:param latitude: Latitude of the venue
|
||||
:type latitude: :obj:`base.Float`
|
||||
|
||||
:param longitude: Longitude of the venue
|
||||
:type longitude: :obj:`base.Float`
|
||||
|
||||
:param title: Name of the venue
|
||||
:type title: :obj:`base.String`
|
||||
|
||||
:param address: Address of the venue
|
||||
:type address: :obj:`base.String`
|
||||
|
||||
:param foursquare_id: Foursquare identifier of the venue
|
||||
:type foursquare_id: :obj:`typing.Union[base.String, None]`
|
||||
:type foursquare_id: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param foursquare_type: Foursquare type of the venue, if known
|
||||
:type foursquare_type: :obj:`typing.Union[base.String, None]`
|
||||
:param disable_notification: Sends the message silently. Users will receive a notification with no sound
|
||||
:type disable_notification: :obj:`typing.Union[base.Boolean, None]`
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original message
|
||||
:type reply_to_message_id: :obj:`typing.Union[base.Integer, None]`
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard,
|
||||
custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user
|
||||
:type foursquare_type: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param google_place_id: Google Places identifier of the venue
|
||||
:type google_place_id: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param google_place_type: Google Places type of the venue. See supported
|
||||
types: https://developers.google.com/places/web-service/supported_types
|
||||
:type google_place_type: :obj:`typing.Optional[base.String]`
|
||||
|
||||
:param disable_notification: Sends the message silently. Users will receive
|
||||
a notification with no sound
|
||||
:type disable_notification: :obj:`typing.Optional[base.Boolean]`
|
||||
|
||||
:param reply_to_message_id: If the message is a reply, ID of the original
|
||||
message
|
||||
:type reply_to_message_id: :obj:`typing.Optional[base.Integer]`
|
||||
|
||||
:param reply_markup: Additional interface options. A JSON-serialized object
|
||||
for an inline keyboard, custom reply keyboard, instructions to remove
|
||||
reply keyboard or to force a reply from the user
|
||||
:type reply_markup: :obj:`typing.Union[types.InlineKeyboardMarkup,
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply, None]`
|
||||
types.ReplyKeyboardMarkup, types.ReplyKeyboardRemove, types.ForceReply,
|
||||
None]`
|
||||
|
||||
:return: On success, the sent Message is returned
|
||||
:rtype: :obj:`types.Message`
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -460,31 +460,40 @@ class InlineQueryResultVenue(InlineQueryResult):
|
|||
title: base.String = fields.Field()
|
||||
address: base.String = fields.Field()
|
||||
foursquare_id: base.String = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
google_place_id: base.String = fields.Field()
|
||||
google_place_type: base.String = fields.Field()
|
||||
input_message_content: InputMessageContent = fields.Field(base=InputMessageContent)
|
||||
thumb_url: base.String = fields.Field()
|
||||
thumb_width: base.Integer = fields.Field()
|
||||
thumb_height: base.Integer = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
|
||||
def __init__(self, *,
|
||||
id: base.String,
|
||||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
title: base.String,
|
||||
address: base.String,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None):
|
||||
super(InlineQueryResultVenue, self).__init__(id=id, latitude=latitude, longitude=longitude,
|
||||
title=title, address=address, foursquare_id=foursquare_id,
|
||||
reply_markup=reply_markup,
|
||||
input_message_content=input_message_content, thumb_url=thumb_url,
|
||||
thumb_width=thumb_width, thumb_height=thumb_height,
|
||||
foursquare_type=foursquare_type)
|
||||
def __init__(
|
||||
self,
|
||||
*,
|
||||
id: base.String,
|
||||
latitude: base.Float,
|
||||
longitude: base.Float,
|
||||
title: base.String,
|
||||
address: base.String,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None,
|
||||
google_place_id: typing.Optional[base.String] = None,
|
||||
google_place_type: typing.Optional[base.String] = None,
|
||||
reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
|
||||
input_message_content: typing.Optional[InputMessageContent] = None,
|
||||
thumb_url: typing.Optional[base.String] = None,
|
||||
thumb_width: typing.Optional[base.Integer] = None,
|
||||
thumb_height: typing.Optional[base.Integer] = None,
|
||||
):
|
||||
super().__init__(
|
||||
id=id, latitude=latitude, longitude=longitude, title=title,
|
||||
address=address, foursquare_id=foursquare_id,
|
||||
foursquare_type=foursquare_type, google_place_id=google_place_id,
|
||||
google_place_type=google_place_type, reply_markup=reply_markup,
|
||||
input_message_content=input_message_content, thumb_url=thumb_url,
|
||||
thumb_width=thumb_width, thumb_height=thumb_height,
|
||||
)
|
||||
|
||||
|
||||
class InlineQueryResultContact(InlineQueryResult):
|
||||
|
|
|
|||
|
|
@ -114,11 +114,24 @@ class InputVenueMessageContent(InputMessageContent):
|
|||
title: base.String = fields.Field()
|
||||
address: base.String = fields.Field()
|
||||
foursquare_id: base.String = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
google_place_id: base.String = fields.Field()
|
||||
google_place_type: base.String = fields.Field()
|
||||
|
||||
def __init__(self, latitude: typing.Optional[base.Float] = None,
|
||||
longitude: typing.Optional[base.Float] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
address: typing.Optional[base.String] = None,
|
||||
foursquare_id: typing.Optional[base.String] = None):
|
||||
super(InputVenueMessageContent, self).__init__(latitude=latitude, longitude=longitude, title=title,
|
||||
address=address, foursquare_id=foursquare_id)
|
||||
def __init__(
|
||||
self,
|
||||
latitude: typing.Optional[base.Float] = None,
|
||||
longitude: typing.Optional[base.Float] = None,
|
||||
title: typing.Optional[base.String] = None,
|
||||
address: typing.Optional[base.String] = None,
|
||||
foursquare_id: typing.Optional[base.String] = None,
|
||||
foursquare_type: typing.Optional[base.String] = None,
|
||||
google_place_id: typing.Optional[base.String] = None,
|
||||
google_place_type: typing.Optional[base.String] = None,
|
||||
):
|
||||
super().__init__(
|
||||
latitude=latitude, longitude=longitude, title=title,
|
||||
address=address, foursquare_id=foursquare_id,
|
||||
foursquare_type=foursquare_type, google_place_id=google_place_id,
|
||||
google_place_type=google_place_type,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -14,3 +14,5 @@ class Venue(base.TelegramObject):
|
|||
address: base.String = fields.Field()
|
||||
foursquare_id: base.String = fields.Field()
|
||||
foursquare_type: base.String = fields.Field()
|
||||
google_place_id: base.String = fields.Field()
|
||||
google_place_type: base.String = fields.Field()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue