id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
224,700 | aiogram/aiogram | aiogram/types/message.py | Message.get_command | def get_command(self, pure=False):
"""
Get command from message
:return:
"""
command = self.get_full_command()
if command:
command = command[0]
if pure:
command, _, _ = command[1:].partition('@')
return command | python | def get_command(self, pure=False):
"""
Get command from message
:return:
"""
command = self.get_full_command()
if command:
command = command[0]
if pure:
command, _, _ = command[1:].partition('@')
return command | [
"def",
"get_command",
"(",
"self",
",",
"pure",
"=",
"False",
")",
":",
"command",
"=",
"self",
".",
"get_full_command",
"(",
")",
"if",
"command",
":",
"command",
"=",
"command",
"[",
"0",
"]",
"if",
"pure",
":",
"command",
",",
"_",
",",
"_",
"="... | Get command from message
:return: | [
"Get",
"command",
"from",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L166-L177 |
224,701 | aiogram/aiogram | aiogram/types/message.py | Message.parse_entities | def parse_entities(self, as_html=True):
"""
Text or caption formatted as HTML or Markdown.
:return: str
"""
text = self.text or self.caption
if text is None:
raise TypeError("This message doesn't have any text.")
quote_fn = md.quote_html if as_html ... | python | def parse_entities(self, as_html=True):
"""
Text or caption formatted as HTML or Markdown.
:return: str
"""
text = self.text or self.caption
if text is None:
raise TypeError("This message doesn't have any text.")
quote_fn = md.quote_html if as_html ... | [
"def",
"parse_entities",
"(",
"self",
",",
"as_html",
"=",
"True",
")",
":",
"text",
"=",
"self",
".",
"text",
"or",
"self",
".",
"caption",
"if",
"text",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"\"This message doesn't have any text.\"",
")",
"quote_fn... | Text or caption formatted as HTML or Markdown.
:return: str | [
"Text",
"or",
"caption",
"formatted",
"as",
"HTML",
"or",
"Markdown",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L189-L231 |
224,702 | aiogram/aiogram | aiogram/types/message.py | Message.url | def url(self) -> str:
"""
Get URL for the message
:return: str
"""
if self.chat.type not in [ChatType.SUPER_GROUP, ChatType.CHANNEL]:
raise TypeError('Invalid chat type!')
elif not self.chat.username:
raise TypeError('This chat does not have @user... | python | def url(self) -> str:
"""
Get URL for the message
:return: str
"""
if self.chat.type not in [ChatType.SUPER_GROUP, ChatType.CHANNEL]:
raise TypeError('Invalid chat type!')
elif not self.chat.username:
raise TypeError('This chat does not have @user... | [
"def",
"url",
"(",
"self",
")",
"->",
"str",
":",
"if",
"self",
".",
"chat",
".",
"type",
"not",
"in",
"[",
"ChatType",
".",
"SUPER_GROUP",
",",
"ChatType",
".",
"CHANNEL",
"]",
":",
"raise",
"TypeError",
"(",
"'Invalid chat type!'",
")",
"elif",
"not"... | Get URL for the message
:return: str | [
"Get",
"URL",
"for",
"the",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L252-L263 |
224,703 | aiogram/aiogram | aiogram/types/message.py | Message.link | def link(self, text, as_html=True) -> str:
"""
Generate URL for using in text messages with HTML or MD parse mode
:param text: link label
:param as_html: generate as HTML
:return: str
"""
try:
url = self.url
except TypeError: # URL is not acc... | python | def link(self, text, as_html=True) -> str:
"""
Generate URL for using in text messages with HTML or MD parse mode
:param text: link label
:param as_html: generate as HTML
:return: str
"""
try:
url = self.url
except TypeError: # URL is not acc... | [
"def",
"link",
"(",
"self",
",",
"text",
",",
"as_html",
"=",
"True",
")",
"->",
"str",
":",
"try",
":",
"url",
"=",
"self",
".",
"url",
"except",
"TypeError",
":",
"# URL is not accessible",
"if",
"as_html",
":",
"return",
"md",
".",
"quote_html",
"("... | Generate URL for using in text messages with HTML or MD parse mode
:param text: link label
:param as_html: generate as HTML
:return: str | [
"Generate",
"URL",
"for",
"using",
"in",
"text",
"messages",
"with",
"HTML",
"or",
"MD",
"parse",
"mode"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L265-L282 |
224,704 | aiogram/aiogram | aiogram/types/message.py | Message.answer | async def answer(self, text, parse_mode=None, disable_web_page_preview=None,
disable_notification=None, reply_markup=None, reply=False) -> Message:
"""
Answer to this message
:param text: str
:param parse_mode: str
:param disable_web_page_preview: bool
... | python | async def answer(self, text, parse_mode=None, disable_web_page_preview=None,
disable_notification=None, reply_markup=None, reply=False) -> Message:
"""
Answer to this message
:param text: str
:param parse_mode: str
:param disable_web_page_preview: bool
... | [
"async",
"def",
"answer",
"(",
"self",
",",
"text",
",",
"parse_mode",
"=",
"None",
",",
"disable_web_page_preview",
"=",
"None",
",",
"disable_notification",
"=",
"None",
",",
"reply_markup",
"=",
"None",
",",
"reply",
"=",
"False",
")",
"->",
"Message",
... | Answer to this message
:param text: str
:param parse_mode: str
:param disable_web_page_preview: bool
:param disable_notification: bool
:param reply_markup:
:param reply: fill 'reply_to_message_id'
:return: :class:`aiogram.types.Message` | [
"Answer",
"to",
"this",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L284-L302 |
224,705 | aiogram/aiogram | aiogram/types/message.py | Message.answer_photo | async def answer_photo(self, photo: typing.Union[base.InputFile, base.String],
caption: typing.Union[base.String, None] = None,
disable_notification: typing.Union[base.Boolean, None] = None,
reply_markup=None, reply=False) -> Message:
... | python | async def answer_photo(self, photo: typing.Union[base.InputFile, base.String],
caption: typing.Union[base.String, None] = None,
disable_notification: typing.Union[base.Boolean, None] = None,
reply_markup=None, reply=False) -> Message:
... | [
"async",
"def",
"answer_photo",
"(",
"self",
",",
"photo",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"InputFile",
",",
"base",
".",
"String",
"]",
",",
"caption",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"String",
",",
"None",
"]",
"=",
... | Use this method to send photos.
Source: https://core.telegram.org/bots/api#sendphoto
:param photo: Photo to send.
:type photo: :obj:`typing.Union[base.InputFile, base.String]`
:param caption: Photo caption (may also be used when resending photos by file_id), 0-200 characters
:t... | [
"Use",
"this",
"method",
"to",
"send",
"photos",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L304-L329 |
224,706 | aiogram/aiogram | aiogram/types/message.py | Message.forward | async def forward(self, chat_id, disable_notification=None) -> Message:
"""
Forward this message
:param chat_id:
:param disable_notification:
:return:
"""
return await self.bot.forward_message(chat_id, self.chat.id, self.message_id, disable_notification) | python | async def forward(self, chat_id, disable_notification=None) -> Message:
"""
Forward this message
:param chat_id:
:param disable_notification:
:return:
"""
return await self.bot.forward_message(chat_id, self.chat.id, self.message_id, disable_notification) | [
"async",
"def",
"forward",
"(",
"self",
",",
"chat_id",
",",
"disable_notification",
"=",
"None",
")",
"->",
"Message",
":",
"return",
"await",
"self",
".",
"bot",
".",
"forward_message",
"(",
"chat_id",
",",
"self",
".",
"chat",
".",
"id",
",",
"self",
... | Forward this message
:param chat_id:
:param disable_notification:
:return: | [
"Forward",
"this",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L1322-L1330 |
224,707 | aiogram/aiogram | aiogram/types/message.py | Message.delete | async def delete(self):
"""
Delete this message
:return: bool
"""
return await self.bot.delete_message(self.chat.id, self.message_id) | python | async def delete(self):
"""
Delete this message
:return: bool
"""
return await self.bot.delete_message(self.chat.id, self.message_id) | [
"async",
"def",
"delete",
"(",
"self",
")",
":",
"return",
"await",
"self",
".",
"bot",
".",
"delete_message",
"(",
"self",
".",
"chat",
".",
"id",
",",
"self",
".",
"message_id",
")"
] | Delete this message
:return: bool | [
"Delete",
"this",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message.py#L1470-L1476 |
224,708 | aiogram/aiogram | aiogram/utils/callback_data.py | CallbackData.new | def new(self, *args, **kwargs) -> str:
"""
Generate callback data
:param args:
:param kwargs:
:return:
"""
args = list(args)
data = [self.prefix]
for part in self._part_names:
value = kwargs.pop(part, None)
if value is No... | python | def new(self, *args, **kwargs) -> str:
"""
Generate callback data
:param args:
:param kwargs:
:return:
"""
args = list(args)
data = [self.prefix]
for part in self._part_names:
value = kwargs.pop(part, None)
if value is No... | [
"def",
"new",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"->",
"str",
":",
"args",
"=",
"list",
"(",
"args",
")",
"data",
"=",
"[",
"self",
".",
"prefix",
"]",
"for",
"part",
"in",
"self",
".",
"_part_names",
":",
"value",
"="... | Generate callback data
:param args:
:param kwargs:
:return: | [
"Generate",
"callback",
"data"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/callback_data.py#L44-L81 |
224,709 | aiogram/aiogram | examples/webhook_example.py | cmd_id | async def cmd_id(message: types.Message):
"""
Return info about user.
"""
if message.reply_to_message:
target = message.reply_to_message.from_user
chat = message.chat
elif message.forward_from and message.chat.type == ChatType.PRIVATE:
target = message.forward_from
ch... | python | async def cmd_id(message: types.Message):
"""
Return info about user.
"""
if message.reply_to_message:
target = message.reply_to_message.from_user
chat = message.chat
elif message.forward_from and message.chat.type == ChatType.PRIVATE:
target = message.forward_from
ch... | [
"async",
"def",
"cmd_id",
"(",
"message",
":",
"types",
".",
"Message",
")",
":",
"if",
"message",
".",
"reply_to_message",
":",
"target",
"=",
"message",
".",
"reply_to_message",
".",
"from_user",
"chat",
"=",
"message",
".",
"chat",
"elif",
"message",
".... | Return info about user. | [
"Return",
"info",
"about",
"user",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/webhook_example.py#L83-L113 |
224,710 | aiogram/aiogram | examples/webhook_example.py | on_shutdown | async def on_shutdown(app):
"""
Graceful shutdown. This method is recommended by aiohttp docs.
"""
# Remove webhook.
await bot.delete_webhook()
# Close Redis connection.
await dp.storage.close()
await dp.storage.wait_closed() | python | async def on_shutdown(app):
"""
Graceful shutdown. This method is recommended by aiohttp docs.
"""
# Remove webhook.
await bot.delete_webhook()
# Close Redis connection.
await dp.storage.close()
await dp.storage.wait_closed() | [
"async",
"def",
"on_shutdown",
"(",
"app",
")",
":",
"# Remove webhook.",
"await",
"bot",
".",
"delete_webhook",
"(",
")",
"# Close Redis connection.",
"await",
"dp",
".",
"storage",
".",
"close",
"(",
")",
"await",
"dp",
".",
"storage",
".",
"wait_closed",
... | Graceful shutdown. This method is recommended by aiohttp docs. | [
"Graceful",
"shutdown",
".",
"This",
"method",
"is",
"recommended",
"by",
"aiohttp",
"docs",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/webhook_example.py#L149-L158 |
224,711 | aiogram/aiogram | aiogram/types/input_file.py | InputFile.from_url | def from_url(cls, url, filename=None, chunk_size=CHUNK_SIZE):
"""
Download file from URL
Manually is not required action. You can send urls instead!
:param url: target URL
:param filename: optional. set custom file name
:param chunk_size:
:return: InputFile
... | python | def from_url(cls, url, filename=None, chunk_size=CHUNK_SIZE):
"""
Download file from URL
Manually is not required action. You can send urls instead!
:param url: target URL
:param filename: optional. set custom file name
:param chunk_size:
:return: InputFile
... | [
"def",
"from_url",
"(",
"cls",
",",
"url",
",",
"filename",
"=",
"None",
",",
"chunk_size",
"=",
"CHUNK_SIZE",
")",
":",
"pipe",
"=",
"_WebPipe",
"(",
"url",
",",
"chunk_size",
"=",
"chunk_size",
")",
"if",
"filename",
"is",
"None",
":",
"filename",
"=... | Download file from URL
Manually is not required action. You can send urls instead!
:param url: target URL
:param filename: optional. set custom file name
:param chunk_size:
:return: InputFile | [
"Download",
"file",
"from",
"URL"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/input_file.py#L101-L117 |
224,712 | aiogram/aiogram | aiogram/types/input_file.py | InputFile.save | def save(self, filename, chunk_size=CHUNK_SIZE):
"""
Write file to disk
:param filename:
:param chunk_size:
"""
with open(filename, 'wb') as fp:
while True:
# Chunk writer
data = self.file.read(chunk_size)
if no... | python | def save(self, filename, chunk_size=CHUNK_SIZE):
"""
Write file to disk
:param filename:
:param chunk_size:
"""
with open(filename, 'wb') as fp:
while True:
# Chunk writer
data = self.file.read(chunk_size)
if no... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"chunk_size",
"=",
"CHUNK_SIZE",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"fp",
":",
"while",
"True",
":",
"# Chunk writer",
"data",
"=",
"self",
".",
"file",
".",
"read",
"(... | Write file to disk
:param filename:
:param chunk_size: | [
"Write",
"file",
"to",
"disk"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/input_file.py#L119-L138 |
224,713 | aiogram/aiogram | aiogram/types/force_reply.py | ForceReply.create | def create(cls, selective: typing.Optional[base.Boolean] = None):
"""
Create new force reply
:param selective:
:return:
"""
return cls(selective=selective) | python | def create(cls, selective: typing.Optional[base.Boolean] = None):
"""
Create new force reply
:param selective:
:return:
"""
return cls(selective=selective) | [
"def",
"create",
"(",
"cls",
",",
"selective",
":",
"typing",
".",
"Optional",
"[",
"base",
".",
"Boolean",
"]",
"=",
"None",
")",
":",
"return",
"cls",
"(",
"selective",
"=",
"selective",
")"
] | Create new force reply
:param selective:
:return: | [
"Create",
"new",
"force",
"reply"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/force_reply.py#L29-L36 |
224,714 | aiogram/aiogram | examples/finite_state_machine_example.py | cancel_handler | async def cancel_handler(message: types.Message, state: FSMContext, raw_state: Optional[str] = None):
"""
Allow user to cancel any action
"""
if raw_state is None:
return
# Cancel state and inform user about it
await state.finish()
# And remove keyboard (just in case)
await mess... | python | async def cancel_handler(message: types.Message, state: FSMContext, raw_state: Optional[str] = None):
"""
Allow user to cancel any action
"""
if raw_state is None:
return
# Cancel state and inform user about it
await state.finish()
# And remove keyboard (just in case)
await mess... | [
"async",
"def",
"cancel_handler",
"(",
"message",
":",
"types",
".",
"Message",
",",
"state",
":",
"FSMContext",
",",
"raw_state",
":",
"Optional",
"[",
"str",
"]",
"=",
"None",
")",
":",
"if",
"raw_state",
"is",
"None",
":",
"return",
"# Cancel state and ... | Allow user to cancel any action | [
"Allow",
"user",
"to",
"cancel",
"any",
"action"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/finite_state_machine_example.py#L44-L54 |
224,715 | aiogram/aiogram | examples/finite_state_machine_example.py | process_name | async def process_name(message: types.Message, state: FSMContext):
"""
Process user name
"""
async with state.proxy() as data:
data['name'] = message.text
await Form.next()
await message.reply("How old are you?") | python | async def process_name(message: types.Message, state: FSMContext):
"""
Process user name
"""
async with state.proxy() as data:
data['name'] = message.text
await Form.next()
await message.reply("How old are you?") | [
"async",
"def",
"process_name",
"(",
"message",
":",
"types",
".",
"Message",
",",
"state",
":",
"FSMContext",
")",
":",
"async",
"with",
"state",
".",
"proxy",
"(",
")",
"as",
"data",
":",
"data",
"[",
"'name'",
"]",
"=",
"message",
".",
"text",
"aw... | Process user name | [
"Process",
"user",
"name"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/finite_state_machine_example.py#L58-L66 |
224,716 | aiogram/aiogram | examples/middleware_and_antiflood.py | rate_limit | def rate_limit(limit: int, key=None):
"""
Decorator for configuring rate limit and key in different functions.
:param limit:
:param key:
:return:
"""
def decorator(func):
setattr(func, 'throttling_rate_limit', limit)
if key:
setattr(func, 'throttling_key', key)
... | python | def rate_limit(limit: int, key=None):
"""
Decorator for configuring rate limit and key in different functions.
:param limit:
:param key:
:return:
"""
def decorator(func):
setattr(func, 'throttling_rate_limit', limit)
if key:
setattr(func, 'throttling_key', key)
... | [
"def",
"rate_limit",
"(",
"limit",
":",
"int",
",",
"key",
"=",
"None",
")",
":",
"def",
"decorator",
"(",
"func",
")",
":",
"setattr",
"(",
"func",
",",
"'throttling_rate_limit'",
",",
"limit",
")",
"if",
"key",
":",
"setattr",
"(",
"func",
",",
"'t... | Decorator for configuring rate limit and key in different functions.
:param limit:
:param key:
:return: | [
"Decorator",
"for",
"configuring",
"rate",
"limit",
"and",
"key",
"in",
"different",
"functions",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/middleware_and_antiflood.py#L21-L36 |
224,717 | aiogram/aiogram | examples/middleware_and_antiflood.py | ThrottlingMiddleware.on_process_message | async def on_process_message(self, message: types.Message, data: dict):
"""
This handler is called when dispatcher receives a message
:param message:
"""
# Get current handler
handler = current_handler.get()
# Get dispatcher from context
dispatcher = Dis... | python | async def on_process_message(self, message: types.Message, data: dict):
"""
This handler is called when dispatcher receives a message
:param message:
"""
# Get current handler
handler = current_handler.get()
# Get dispatcher from context
dispatcher = Dis... | [
"async",
"def",
"on_process_message",
"(",
"self",
",",
"message",
":",
"types",
".",
"Message",
",",
"data",
":",
"dict",
")",
":",
"# Get current handler",
"handler",
"=",
"current_handler",
".",
"get",
"(",
")",
"# Get dispatcher from context",
"dispatcher",
... | This handler is called when dispatcher receives a message
:param message: | [
"This",
"handler",
"is",
"called",
"when",
"dispatcher",
"receives",
"a",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/middleware_and_antiflood.py#L49-L76 |
224,718 | aiogram/aiogram | examples/middleware_and_antiflood.py | ThrottlingMiddleware.message_throttled | async def message_throttled(self, message: types.Message, throttled: Throttled):
"""
Notify user only on first exceed and notify about unlocking only on last exceed
:param message:
:param throttled:
"""
handler = current_handler.get()
dispatcher = Dispatcher.get_... | python | async def message_throttled(self, message: types.Message, throttled: Throttled):
"""
Notify user only on first exceed and notify about unlocking only on last exceed
:param message:
:param throttled:
"""
handler = current_handler.get()
dispatcher = Dispatcher.get_... | [
"async",
"def",
"message_throttled",
"(",
"self",
",",
"message",
":",
"types",
".",
"Message",
",",
"throttled",
":",
"Throttled",
")",
":",
"handler",
"=",
"current_handler",
".",
"get",
"(",
")",
"dispatcher",
"=",
"Dispatcher",
".",
"get_current",
"(",
... | Notify user only on first exceed and notify about unlocking only on last exceed
:param message:
:param throttled: | [
"Notify",
"user",
"only",
"on",
"first",
"exceed",
"and",
"notify",
"about",
"unlocking",
"only",
"on",
"last",
"exceed"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/middleware_and_antiflood.py#L78-L107 |
224,719 | aiogram/aiogram | aiogram/utils/auth_widget.py | generate_hash | def generate_hash(data: dict, token: str) -> str:
"""
Generate secret hash
:param data:
:param token:
:return:
"""
secret = hashlib.sha256()
secret.update(token.encode('utf-8'))
sorted_params = collections.OrderedDict(sorted(data.items()))
msg = '\n'.join("{}={}".format(k, v) fo... | python | def generate_hash(data: dict, token: str) -> str:
"""
Generate secret hash
:param data:
:param token:
:return:
"""
secret = hashlib.sha256()
secret.update(token.encode('utf-8'))
sorted_params = collections.OrderedDict(sorted(data.items()))
msg = '\n'.join("{}={}".format(k, v) fo... | [
"def",
"generate_hash",
"(",
"data",
":",
"dict",
",",
"token",
":",
"str",
")",
"->",
"str",
":",
"secret",
"=",
"hashlib",
".",
"sha256",
"(",
")",
"secret",
".",
"update",
"(",
"token",
".",
"encode",
"(",
"'utf-8'",
")",
")",
"sorted_params",
"="... | Generate secret hash
:param data:
:param token:
:return: | [
"Generate",
"secret",
"hash"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/auth_widget.py#L12-L24 |
224,720 | aiogram/aiogram | aiogram/utils/auth_widget.py | check_token | def check_token(data: dict, token: str) -> bool:
"""
Validate auth token
:param data:
:param token:
:return:
"""
param_hash = data.get('hash', '') or ''
return param_hash == generate_hash(data, token) | python | def check_token(data: dict, token: str) -> bool:
"""
Validate auth token
:param data:
:param token:
:return:
"""
param_hash = data.get('hash', '') or ''
return param_hash == generate_hash(data, token) | [
"def",
"check_token",
"(",
"data",
":",
"dict",
",",
"token",
":",
"str",
")",
"->",
"bool",
":",
"param_hash",
"=",
"data",
".",
"get",
"(",
"'hash'",
",",
"''",
")",
"or",
"''",
"return",
"param_hash",
"==",
"generate_hash",
"(",
"data",
",",
"toke... | Validate auth token
:param data:
:param token:
:return: | [
"Validate",
"auth",
"token"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/auth_widget.py#L27-L36 |
224,721 | aiogram/aiogram | aiogram/dispatcher/filters/factory.py | FiltersFactory.resolve | def resolve(self, event_handler, *custom_filters, **full_config
) -> typing.List[typing.Union[typing.Callable, AbstractFilter]]:
"""
Resolve filters to filters-set
:param event_handler:
:param custom_filters:
:param full_config:
:return:
"""
... | python | def resolve(self, event_handler, *custom_filters, **full_config
) -> typing.List[typing.Union[typing.Callable, AbstractFilter]]:
"""
Resolve filters to filters-set
:param event_handler:
:param custom_filters:
:param full_config:
:return:
"""
... | [
"def",
"resolve",
"(",
"self",
",",
"event_handler",
",",
"*",
"custom_filters",
",",
"*",
"*",
"full_config",
")",
"->",
"typing",
".",
"List",
"[",
"typing",
".",
"Union",
"[",
"typing",
".",
"Callable",
",",
"AbstractFilter",
"]",
"]",
":",
"filters_s... | Resolve filters to filters-set
:param event_handler:
:param custom_filters:
:param full_config:
:return: | [
"Resolve",
"filters",
"to",
"filters",
"-",
"set"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/filters/factory.py#L41-L57 |
224,722 | aiogram/aiogram | aiogram/dispatcher/filters/factory.py | FiltersFactory._resolve_registered | def _resolve_registered(self, event_handler, full_config) -> typing.Generator:
"""
Resolve registered filters
:param event_handler:
:param full_config:
:return:
"""
for record in self._registered:
filter_ = record.resolve(self._dispatcher, event_handl... | python | def _resolve_registered(self, event_handler, full_config) -> typing.Generator:
"""
Resolve registered filters
:param event_handler:
:param full_config:
:return:
"""
for record in self._registered:
filter_ = record.resolve(self._dispatcher, event_handl... | [
"def",
"_resolve_registered",
"(",
"self",
",",
"event_handler",
",",
"full_config",
")",
"->",
"typing",
".",
"Generator",
":",
"for",
"record",
"in",
"self",
".",
"_registered",
":",
"filter_",
"=",
"record",
".",
"resolve",
"(",
"self",
".",
"_dispatcher"... | Resolve registered filters
:param event_handler:
:param full_config:
:return: | [
"Resolve",
"registered",
"filters"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/filters/factory.py#L59-L73 |
224,723 | aiogram/aiogram | aiogram/types/auth_widget_data.py | AuthWidgetData.parse | def parse(cls, request: web.Request) -> AuthWidgetData:
"""
Parse request as Telegram auth widget data.
:param request:
:return: :obj:`AuthWidgetData`
:raise: :obj:`aiohttp.web.HTTPBadRequest`
"""
try:
query = dict(request.query)
query['id... | python | def parse(cls, request: web.Request) -> AuthWidgetData:
"""
Parse request as Telegram auth widget data.
:param request:
:return: :obj:`AuthWidgetData`
:raise: :obj:`aiohttp.web.HTTPBadRequest`
"""
try:
query = dict(request.query)
query['id... | [
"def",
"parse",
"(",
"cls",
",",
"request",
":",
"web",
".",
"Request",
")",
"->",
"AuthWidgetData",
":",
"try",
":",
"query",
"=",
"dict",
"(",
"request",
".",
"query",
")",
"query",
"[",
"'id'",
"]",
"=",
"int",
"(",
"query",
"[",
"'id'",
"]",
... | Parse request as Telegram auth widget data.
:param request:
:return: :obj:`AuthWidgetData`
:raise: :obj:`aiohttp.web.HTTPBadRequest` | [
"Parse",
"request",
"as",
"Telegram",
"auth",
"widget",
"data",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/auth_widget_data.py#L19-L35 |
224,724 | aiogram/aiogram | aiogram/dispatcher/webhook.py | _check_ip | def _check_ip(ip: str) -> bool:
"""
Check IP in range
:param ip:
:return:
"""
address = ipaddress.IPv4Address(ip)
return address in allowed_ips | python | def _check_ip(ip: str) -> bool:
"""
Check IP in range
:param ip:
:return:
"""
address = ipaddress.IPv4Address(ip)
return address in allowed_ips | [
"def",
"_check_ip",
"(",
"ip",
":",
"str",
")",
"->",
"bool",
":",
"address",
"=",
"ipaddress",
".",
"IPv4Address",
"(",
"ip",
")",
"return",
"address",
"in",
"allowed_ips"
] | Check IP in range
:param ip:
:return: | [
"Check",
"IP",
"in",
"range"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L39-L47 |
224,725 | aiogram/aiogram | aiogram/dispatcher/webhook.py | allow_ip | def allow_ip(*ips: typing.Union[str, ipaddress.IPv4Network, ipaddress.IPv4Address]):
"""
Allow ip address.
:param ips:
:return:
"""
for ip in ips:
if isinstance(ip, ipaddress.IPv4Address):
allowed_ips.add(ip)
elif isinstance(ip, str):
allowed_ips.add(ipad... | python | def allow_ip(*ips: typing.Union[str, ipaddress.IPv4Network, ipaddress.IPv4Address]):
"""
Allow ip address.
:param ips:
:return:
"""
for ip in ips:
if isinstance(ip, ipaddress.IPv4Address):
allowed_ips.add(ip)
elif isinstance(ip, str):
allowed_ips.add(ipad... | [
"def",
"allow_ip",
"(",
"*",
"ips",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"ipaddress",
".",
"IPv4Network",
",",
"ipaddress",
".",
"IPv4Address",
"]",
")",
":",
"for",
"ip",
"in",
"ips",
":",
"if",
"isinstance",
"(",
"ip",
",",
"ipaddress",
".... | Allow ip address.
:param ips:
:return: | [
"Allow",
"ip",
"address",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L50-L65 |
224,726 | aiogram/aiogram | aiogram/dispatcher/webhook.py | configure_app | def configure_app(dispatcher, app: web.Application, path=DEFAULT_WEB_PATH, route_name=DEFAULT_ROUTE_NAME):
"""
You can prepare web.Application for working with webhook handler.
:param dispatcher: Dispatcher instance
:param app: :class:`aiohttp.web.Application`
:param path: Path to your webhook.
... | python | def configure_app(dispatcher, app: web.Application, path=DEFAULT_WEB_PATH, route_name=DEFAULT_ROUTE_NAME):
"""
You can prepare web.Application for working with webhook handler.
:param dispatcher: Dispatcher instance
:param app: :class:`aiohttp.web.Application`
:param path: Path to your webhook.
... | [
"def",
"configure_app",
"(",
"dispatcher",
",",
"app",
":",
"web",
".",
"Application",
",",
"path",
"=",
"DEFAULT_WEB_PATH",
",",
"route_name",
"=",
"DEFAULT_ROUTE_NAME",
")",
":",
"app",
".",
"router",
".",
"add_route",
"(",
"'*'",
",",
"path",
",",
"Webh... | You can prepare web.Application for working with webhook handler.
:param dispatcher: Dispatcher instance
:param app: :class:`aiohttp.web.Application`
:param path: Path to your webhook.
:param route_name: Name of webhook handler route
:return: | [
"You",
"can",
"prepare",
"web",
".",
"Application",
"for",
"working",
"with",
"webhook",
"handler",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L278-L289 |
224,727 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.get_dispatcher | def get_dispatcher(self):
"""
Get Dispatcher instance from environment
:return: :class:`aiogram.Dispatcher`
"""
dp = self.request.app[BOT_DISPATCHER_KEY]
try:
from aiogram import Bot, Dispatcher
Dispatcher.set_current(dp)
Bot.set_curre... | python | def get_dispatcher(self):
"""
Get Dispatcher instance from environment
:return: :class:`aiogram.Dispatcher`
"""
dp = self.request.app[BOT_DISPATCHER_KEY]
try:
from aiogram import Bot, Dispatcher
Dispatcher.set_current(dp)
Bot.set_curre... | [
"def",
"get_dispatcher",
"(",
"self",
")",
":",
"dp",
"=",
"self",
".",
"request",
".",
"app",
"[",
"BOT_DISPATCHER_KEY",
"]",
"try",
":",
"from",
"aiogram",
"import",
"Bot",
",",
"Dispatcher",
"Dispatcher",
".",
"set_current",
"(",
"dp",
")",
"Bot",
"."... | Get Dispatcher instance from environment
:return: :class:`aiogram.Dispatcher` | [
"Get",
"Dispatcher",
"instance",
"from",
"environment"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L93-L106 |
224,728 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.parse_update | async def parse_update(self, bot):
"""
Read update from stream and deserialize it.
:param bot: bot instance. You an get it from Dispatcher
:return: :class:`aiogram.types.Update`
"""
data = await self.request.json()
update = types.Update(**data)
return upd... | python | async def parse_update(self, bot):
"""
Read update from stream and deserialize it.
:param bot: bot instance. You an get it from Dispatcher
:return: :class:`aiogram.types.Update`
"""
data = await self.request.json()
update = types.Update(**data)
return upd... | [
"async",
"def",
"parse_update",
"(",
"self",
",",
"bot",
")",
":",
"data",
"=",
"await",
"self",
".",
"request",
".",
"json",
"(",
")",
"update",
"=",
"types",
".",
"Update",
"(",
"*",
"*",
"data",
")",
"return",
"update"
] | Read update from stream and deserialize it.
:param bot: bot instance. You an get it from Dispatcher
:return: :class:`aiogram.types.Update` | [
"Read",
"update",
"from",
"stream",
"and",
"deserialize",
"it",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L108-L117 |
224,729 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.post | async def post(self):
"""
Process POST request
if one of handler returns instance of :class:`aiogram.dispatcher.webhook.BaseResponse` return it to webhook.
Otherwise do nothing (return 'ok')
:return: :class:`aiohttp.web.Response`
"""
self.validate_ip()
... | python | async def post(self):
"""
Process POST request
if one of handler returns instance of :class:`aiogram.dispatcher.webhook.BaseResponse` return it to webhook.
Otherwise do nothing (return 'ok')
:return: :class:`aiohttp.web.Response`
"""
self.validate_ip()
... | [
"async",
"def",
"post",
"(",
"self",
")",
":",
"self",
".",
"validate_ip",
"(",
")",
"# context.update_state({'CALLER': WEBHOOK,",
"# WEBHOOK_CONNECTION: True,",
"# WEBHOOK_REQUEST: self.request})",
"dispatcher",
"=",
"self",
".",
"ge... | Process POST request
if one of handler returns instance of :class:`aiogram.dispatcher.webhook.BaseResponse` return it to webhook.
Otherwise do nothing (return 'ok')
:return: :class:`aiohttp.web.Response` | [
"Process",
"POST",
"request"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L119-L148 |
224,730 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.process_update | async def process_update(self, update):
"""
Need respond in less than 60 seconds in to webhook.
So... If you respond greater than 55 seconds webhook automatically respond 'ok'
and execute callback response via simple HTTP request.
:param update:
:return:
"""
... | python | async def process_update(self, update):
"""
Need respond in less than 60 seconds in to webhook.
So... If you respond greater than 55 seconds webhook automatically respond 'ok'
and execute callback response via simple HTTP request.
:param update:
:return:
"""
... | [
"async",
"def",
"process_update",
"(",
"self",
",",
"update",
")",
":",
"dispatcher",
"=",
"self",
".",
"get_dispatcher",
"(",
")",
"loop",
"=",
"dispatcher",
".",
"loop",
"# Analog of `asyncio.wait_for` but without cancelling task",
"waiter",
"=",
"loop",
".",
"c... | Need respond in less than 60 seconds in to webhook.
So... If you respond greater than 55 seconds webhook automatically respond 'ok'
and execute callback response via simple HTTP request.
:param update:
:return: | [
"Need",
"respond",
"in",
"less",
"than",
"60",
"seconds",
"in",
"to",
"webhook",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L158-L194 |
224,731 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.respond_via_request | def respond_via_request(self, task):
"""
Handle response after 55 second.
:param task:
:return:
"""
warn(f"Detected slow response into webhook. "
f"(Greater than {RESPONSE_TIMEOUT} seconds)\n"
f"Recommended to use 'async_task' decorator from Dis... | python | def respond_via_request(self, task):
"""
Handle response after 55 second.
:param task:
:return:
"""
warn(f"Detected slow response into webhook. "
f"(Greater than {RESPONSE_TIMEOUT} seconds)\n"
f"Recommended to use 'async_task' decorator from Dis... | [
"def",
"respond_via_request",
"(",
"self",
",",
"task",
")",
":",
"warn",
"(",
"f\"Detected slow response into webhook. \"",
"f\"(Greater than {RESPONSE_TIMEOUT} seconds)\\n\"",
"f\"Recommended to use 'async_task' decorator from Dispatcher for handler with long timeouts.\"",
",",
"Timeou... | Handle response after 55 second.
:param task:
:return: | [
"Handle",
"response",
"after",
"55",
"second",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L196-L219 |
224,732 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.get_response | def get_response(self, results):
"""
Get response object from results.
:param results: list
:return:
"""
if results is None:
return None
for result in itertools.chain.from_iterable(results):
if isinstance(result, BaseResponse):
... | python | def get_response(self, results):
"""
Get response object from results.
:param results: list
:return:
"""
if results is None:
return None
for result in itertools.chain.from_iterable(results):
if isinstance(result, BaseResponse):
... | [
"def",
"get_response",
"(",
"self",
",",
"results",
")",
":",
"if",
"results",
"is",
"None",
":",
"return",
"None",
"for",
"result",
"in",
"itertools",
".",
"chain",
".",
"from_iterable",
"(",
"results",
")",
":",
"if",
"isinstance",
"(",
"result",
",",
... | Get response object from results.
:param results: list
:return: | [
"Get",
"response",
"object",
"from",
"results",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L221-L232 |
224,733 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.check_ip | def check_ip(self):
"""
Check client IP. Accept requests only from telegram servers.
:return:
"""
# For reverse proxy (nginx)
forwarded_for = self.request.headers.get('X-Forwarded-For', None)
if forwarded_for:
return forwarded_for, _check_ip(forwarded... | python | def check_ip(self):
"""
Check client IP. Accept requests only from telegram servers.
:return:
"""
# For reverse proxy (nginx)
forwarded_for = self.request.headers.get('X-Forwarded-For', None)
if forwarded_for:
return forwarded_for, _check_ip(forwarded... | [
"def",
"check_ip",
"(",
"self",
")",
":",
"# For reverse proxy (nginx)",
"forwarded_for",
"=",
"self",
".",
"request",
".",
"headers",
".",
"get",
"(",
"'X-Forwarded-For'",
",",
"None",
")",
"if",
"forwarded_for",
":",
"return",
"forwarded_for",
",",
"_check_ip"... | Check client IP. Accept requests only from telegram servers.
:return: | [
"Check",
"client",
"IP",
".",
"Accept",
"requests",
"only",
"from",
"telegram",
"servers",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L234-L252 |
224,734 | aiogram/aiogram | aiogram/dispatcher/webhook.py | WebhookRequestHandler.validate_ip | def validate_ip(self):
"""
Check ip if that is needed. Raise web.HTTPUnauthorized for not allowed hosts.
"""
if self.request.app.get('_check_ip', False):
ip_address, accept = self.check_ip()
if not accept:
raise web.HTTPUnauthorized() | python | def validate_ip(self):
"""
Check ip if that is needed. Raise web.HTTPUnauthorized for not allowed hosts.
"""
if self.request.app.get('_check_ip', False):
ip_address, accept = self.check_ip()
if not accept:
raise web.HTTPUnauthorized() | [
"def",
"validate_ip",
"(",
"self",
")",
":",
"if",
"self",
".",
"request",
".",
"app",
".",
"get",
"(",
"'_check_ip'",
",",
"False",
")",
":",
"ip_address",
",",
"accept",
"=",
"self",
".",
"check_ip",
"(",
")",
"if",
"not",
"accept",
":",
"raise",
... | Check ip if that is needed. Raise web.HTTPUnauthorized for not allowed hosts. | [
"Check",
"ip",
"if",
"that",
"is",
"needed",
".",
"Raise",
"web",
".",
"HTTPUnauthorized",
"for",
"not",
"allowed",
"hosts",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L254-L261 |
224,735 | aiogram/aiogram | aiogram/dispatcher/webhook.py | BaseResponse.cleanup | def cleanup(self) -> typing.Dict:
"""
Cleanup response after preparing. Remove empty fields.
:return: response parameters dict
"""
return {k: v for k, v in self.prepare().items() if v is not None} | python | def cleanup(self) -> typing.Dict:
"""
Cleanup response after preparing. Remove empty fields.
:return: response parameters dict
"""
return {k: v for k, v in self.prepare().items() if v is not None} | [
"def",
"cleanup",
"(",
"self",
")",
"->",
"typing",
".",
"Dict",
":",
"return",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"self",
".",
"prepare",
"(",
")",
".",
"items",
"(",
")",
"if",
"v",
"is",
"not",
"None",
"}"
] | Cleanup response after preparing. Remove empty fields.
:return: response parameters dict | [
"Cleanup",
"response",
"after",
"preparing",
".",
"Remove",
"empty",
"fields",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L327-L333 |
224,736 | aiogram/aiogram | aiogram/dispatcher/webhook.py | BaseResponse.execute_response | async def execute_response(self, bot):
"""
Use this method if you want to execute response as simple HTTP request.
:param bot: Bot instance.
:return:
"""
method_name = helper.HelperMode.apply(self.method, helper.HelperMode.snake_case)
method = getattr(bot, method... | python | async def execute_response(self, bot):
"""
Use this method if you want to execute response as simple HTTP request.
:param bot: Bot instance.
:return:
"""
method_name = helper.HelperMode.apply(self.method, helper.HelperMode.snake_case)
method = getattr(bot, method... | [
"async",
"def",
"execute_response",
"(",
"self",
",",
"bot",
")",
":",
"method_name",
"=",
"helper",
".",
"HelperMode",
".",
"apply",
"(",
"self",
".",
"method",
",",
"helper",
".",
"HelperMode",
".",
"snake_case",
")",
"method",
"=",
"getattr",
"(",
"bo... | Use this method if you want to execute response as simple HTTP request.
:param bot: Bot instance.
:return: | [
"Use",
"this",
"method",
"if",
"you",
"want",
"to",
"execute",
"response",
"as",
"simple",
"HTTP",
"request",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L351-L362 |
224,737 | aiogram/aiogram | aiogram/dispatcher/webhook.py | ReplyToMixin.reply | def reply(self, message: typing.Union[int, types.Message]):
"""
Reply to message
:param message: :obj:`int` or :obj:`types.Message`
:return: self
"""
setattr(self, 'reply_to_message_id', message.message_id if isinstance(message, types.Message) else message)
retu... | python | def reply(self, message: typing.Union[int, types.Message]):
"""
Reply to message
:param message: :obj:`int` or :obj:`types.Message`
:return: self
"""
setattr(self, 'reply_to_message_id', message.message_id if isinstance(message, types.Message) else message)
retu... | [
"def",
"reply",
"(",
"self",
",",
"message",
":",
"typing",
".",
"Union",
"[",
"int",
",",
"types",
".",
"Message",
"]",
")",
":",
"setattr",
"(",
"self",
",",
"'reply_to_message_id'",
",",
"message",
".",
"message_id",
"if",
"isinstance",
"(",
"message"... | Reply to message
:param message: :obj:`int` or :obj:`types.Message`
:return: self | [
"Reply",
"to",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L382-L390 |
224,738 | aiogram/aiogram | aiogram/dispatcher/webhook.py | ReplyToMixin.to | def to(self, target: typing.Union[types.Message, types.Chat, types.base.Integer, types.base.String]):
"""
Send to chat
:param target: message or chat or id
:return:
"""
if isinstance(target, types.Message):
chat_id = target.chat.id
elif isinstance(tar... | python | def to(self, target: typing.Union[types.Message, types.Chat, types.base.Integer, types.base.String]):
"""
Send to chat
:param target: message or chat or id
:return:
"""
if isinstance(target, types.Message):
chat_id = target.chat.id
elif isinstance(tar... | [
"def",
"to",
"(",
"self",
",",
"target",
":",
"typing",
".",
"Union",
"[",
"types",
".",
"Message",
",",
"types",
".",
"Chat",
",",
"types",
".",
"base",
".",
"Integer",
",",
"types",
".",
"base",
".",
"String",
"]",
")",
":",
"if",
"isinstance",
... | Send to chat
:param target: message or chat or id
:return: | [
"Send",
"to",
"chat"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L392-L409 |
224,739 | aiogram/aiogram | aiogram/dispatcher/webhook.py | SendMessage.write | def write(self, *text, sep=' '):
"""
Write text to response
:param text:
:param sep:
:return:
"""
self.text += markdown.text(*text, sep)
return self | python | def write(self, *text, sep=' '):
"""
Write text to response
:param text:
:param sep:
:return:
"""
self.text += markdown.text(*text, sep)
return self | [
"def",
"write",
"(",
"self",
",",
"*",
"text",
",",
"sep",
"=",
"' '",
")",
":",
"self",
".",
"text",
"+=",
"markdown",
".",
"text",
"(",
"*",
"text",
",",
"sep",
")",
"return",
"self"
] | Write text to response
:param text:
:param sep:
:return: | [
"Write",
"text",
"to",
"response"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L524-L533 |
224,740 | aiogram/aiogram | aiogram/dispatcher/webhook.py | ForwardMessage.message | def message(self, message: types.Message):
"""
Select target message
:param message:
:return:
"""
setattr(self, 'from_chat_id', message.chat.id)
setattr(self, 'message_id', message.message_id)
return self | python | def message(self, message: types.Message):
"""
Select target message
:param message:
:return:
"""
setattr(self, 'from_chat_id', message.chat.id)
setattr(self, 'message_id', message.message_id)
return self | [
"def",
"message",
"(",
"self",
",",
"message",
":",
"types",
".",
"Message",
")",
":",
"setattr",
"(",
"self",
",",
"'from_chat_id'",
",",
"message",
".",
"chat",
".",
"id",
")",
"setattr",
"(",
"self",
",",
"'message_id'",
",",
"message",
".",
"messag... | Select target message
:param message:
:return: | [
"Select",
"target",
"message"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/webhook.py#L575-L584 |
224,741 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.check_address | def check_address(cls, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None) -> (typing.Union[str, int], typing.Union[str, int]):
"""
In all storage's methods chat or user is always required.
If one of them is not pro... | python | def check_address(cls, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None) -> (typing.Union[str, int], typing.Union[str, int]):
"""
In all storage's methods chat or user is always required.
If one of them is not pro... | [
"def",
"check_address",
"(",
"cls",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
")",... | In all storage's methods chat or user is always required.
If one of them is not provided, you have to set missing value based on the provided one.
This method performs the check described above.
:param chat:
:param user:
:return: | [
"In",
"all",
"storage",
"s",
"methods",
"chat",
"or",
"user",
"is",
"always",
"required",
".",
"If",
"one",
"of",
"them",
"is",
"not",
"provided",
"you",
"have",
"to",
"set",
"missing",
"value",
"based",
"on",
"the",
"provided",
"one",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L41-L61 |
224,742 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.get_data | async def get_data(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
default: typing.Optional[typing.Dict] = None) -> typing.Dict:
"""
Get state-data for user in chat. Return `default` if no... | python | async def get_data(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
default: typing.Optional[typing.Dict] = None) -> typing.Dict:
"""
Get state-data for user in chat. Return `default` if no... | [
"async",
"def",
"get_data",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",... | Get state-data for user in chat. Return `default` if no data is provided in storage.
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param chat:
:param user:
:param default:
:return: | [
"Get",
"state",
"-",
"data",
"for",
"user",
"in",
"chat",
".",
"Return",
"default",
"if",
"no",
"data",
"is",
"provided",
"in",
"storage",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L80-L95 |
224,743 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.update_data | async def update_data(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
data: typing.Dict = None,
**kwargs):
"""
Update data for user in chat
You ... | python | async def update_data(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
data: typing.Dict = None,
**kwargs):
"""
Update data for user in chat
You ... | [
"async",
"def",
"update_data",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"Non... | Update data for user in chat
You can use data parameter or|and kwargs.
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param data:
:param chat:
:param user:
:param kwargs:
:retur... | [
"Update",
"data",
"for",
"user",
"in",
"chat"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L129-L148 |
224,744 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.reset_state | async def reset_state(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
with_data: typing.Optional[bool] = True):
"""
Reset state for user in chat.
You may desire to use thi... | python | async def reset_state(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
with_data: typing.Optional[bool] = True):
"""
Reset state for user in chat.
You may desire to use thi... | [
"async",
"def",
"reset_state",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"Non... | Reset state for user in chat.
You may desire to use this method when finishing conversations.
Chat or user is always required. If one of this is not presented,
you have to set missing value based on the provided one.
:param chat:
:param user:
:param with_data:
:... | [
"Reset",
"state",
"for",
"user",
"in",
"chat",
".",
"You",
"may",
"desire",
"to",
"use",
"this",
"method",
"when",
"finishing",
"conversations",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L165-L184 |
224,745 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.finish | async def finish(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None):
"""
Finish conversation for user in chat.
Chat or user is always required. If one of them is not provided,
you have to set missing v... | python | async def finish(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None):
"""
Finish conversation for user in chat.
Chat or user is always required. If one of them is not provided,
you have to set missing v... | [
"async",
"def",
"finish",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
... | Finish conversation for user in chat.
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param chat:
:param user:
:return: | [
"Finish",
"conversation",
"for",
"user",
"in",
"chat",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L186-L199 |
224,746 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.get_bucket | async def get_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
default: typing.Optional[dict] = None) -> typing.Dict:
"""
Get bucket for user in chat. Return `default` if no da... | python | async def get_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
default: typing.Optional[dict] = None) -> typing.Dict:
"""
Get bucket for user in chat. Return `default` if no da... | [
"async",
"def",
"get_bucket",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None... | Get bucket for user in chat. Return `default` if no data is provided in storage.
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param chat:
:param user:
:param default:
:return: | [
"Get",
"bucket",
"for",
"user",
"in",
"chat",
".",
"Return",
"default",
"if",
"no",
"data",
"is",
"provided",
"in",
"storage",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L204-L219 |
224,747 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.set_bucket | async def set_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
bucket: typing.Dict = None):
"""
Set bucket for user in chat
Chat or user is always required. If one of ... | python | async def set_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
bucket: typing.Dict = None):
"""
Set bucket for user in chat
Chat or user is always required. If one of ... | [
"async",
"def",
"set_bucket",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None... | Set bucket for user in chat
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param chat:
:param user:
:param bucket: | [
"Set",
"bucket",
"for",
"user",
"in",
"chat"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L221-L235 |
224,748 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.update_bucket | async def update_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
bucket: typing.Dict = None,
**kwargs):
"""
Update bucket for user in chat... | python | async def update_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None,
bucket: typing.Dict = None,
**kwargs):
"""
Update bucket for user in chat... | [
"async",
"def",
"update_bucket",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"N... | Update bucket for user in chat
You can use bucket parameter or|and kwargs.
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param bucket:
:param chat:
:param user:
:param kwargs:
... | [
"Update",
"bucket",
"for",
"user",
"in",
"chat"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L237-L256 |
224,749 | aiogram/aiogram | aiogram/dispatcher/storage.py | BaseStorage.reset_bucket | async def reset_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None):
"""
Reset bucket dor user in chat.
Chat or user is always required. If one of them is not provided,
you have to se... | python | async def reset_bucket(self, *,
chat: typing.Union[str, int, None] = None,
user: typing.Union[str, int, None] = None):
"""
Reset bucket dor user in chat.
Chat or user is always required. If one of them is not provided,
you have to se... | [
"async",
"def",
"reset_bucket",
"(",
"self",
",",
"*",
",",
"chat",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"None",
",",
"user",
":",
"typing",
".",
"Union",
"[",
"str",
",",
"int",
",",
"None",
"]",
"=",
"No... | Reset bucket dor user in chat.
Chat or user is always required. If one of them is not provided,
you have to set missing value based on the provided one.
:param chat:
:param user:
:return: | [
"Reset",
"bucket",
"dor",
"user",
"in",
"chat",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/storage.py#L258-L271 |
224,750 | aiogram/aiogram | aiogram/contrib/fsm_storage/rethinkdb.py | RethinkDBStorage.connect | async def connect(self) -> Connection:
"""
Get or create a connection.
"""
if self._conn is None:
self._conn = await r.connect(host=self._host,
port=self._port,
db=self._db,
... | python | async def connect(self) -> Connection:
"""
Get or create a connection.
"""
if self._conn is None:
self._conn = await r.connect(host=self._host,
port=self._port,
db=self._db,
... | [
"async",
"def",
"connect",
"(",
"self",
")",
"->",
"Connection",
":",
"if",
"self",
".",
"_conn",
"is",
"None",
":",
"self",
".",
"_conn",
"=",
"await",
"r",
".",
"connect",
"(",
"host",
"=",
"self",
".",
"_host",
",",
"port",
"=",
"self",
".",
"... | Get or create a connection. | [
"Get",
"or",
"create",
"a",
"connection",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/contrib/fsm_storage/rethinkdb.py#L59-L73 |
224,751 | aiogram/aiogram | aiogram/types/input_media.py | MediaGroup.attach_many | def attach_many(self, *medias: typing.Union[InputMedia, typing.Dict]):
"""
Attach list of media
:param medias:
"""
for media in medias:
self.attach(media) | python | def attach_many(self, *medias: typing.Union[InputMedia, typing.Dict]):
"""
Attach list of media
:param medias:
"""
for media in medias:
self.attach(media) | [
"def",
"attach_many",
"(",
"self",
",",
"*",
"medias",
":",
"typing",
".",
"Union",
"[",
"InputMedia",
",",
"typing",
".",
"Dict",
"]",
")",
":",
"for",
"media",
"in",
"medias",
":",
"self",
".",
"attach",
"(",
"media",
")"
] | Attach list of media
:param medias: | [
"Attach",
"list",
"of",
"media"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/input_media.py#L209-L216 |
224,752 | aiogram/aiogram | aiogram/dispatcher/filters/builtin.py | Command.validate | def validate(cls, full_config: Dict[str, Any]) -> Optional[Dict[str, Any]]:
"""
Validator for filters factory
From filters factory this filter can be registered with arguments:
- ``command``
- ``commands_prefix`` (will be passed as ``prefixes``)
- ``commands_ignore_m... | python | def validate(cls, full_config: Dict[str, Any]) -> Optional[Dict[str, Any]]:
"""
Validator for filters factory
From filters factory this filter can be registered with arguments:
- ``command``
- ``commands_prefix`` (will be passed as ``prefixes``)
- ``commands_ignore_m... | [
"def",
"validate",
"(",
"cls",
",",
"full_config",
":",
"Dict",
"[",
"str",
",",
"Any",
"]",
")",
"->",
"Optional",
"[",
"Dict",
"[",
"str",
",",
"Any",
"]",
"]",
":",
"config",
"=",
"{",
"}",
"if",
"'commands'",
"in",
"full_config",
":",
"config",... | Validator for filters factory
From filters factory this filter can be registered with arguments:
- ``command``
- ``commands_prefix`` (will be passed as ``prefixes``)
- ``commands_ignore_mention`` (will be passed as ``ignore_mention``
:param full_config:
:return: con... | [
"Validator",
"for",
"filters",
"factory"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/filters/builtin.py#L55-L75 |
224,753 | aiogram/aiogram | aiogram/dispatcher/filters/builtin.py | CommandStart.check | async def check(self, message: types.Message):
"""
If deep-linking is passed to the filter result of the matching will be passed as ``deep_link`` to the handler
:param message:
:return:
"""
check = await super(CommandStart, self).check(message)
if check and self... | python | async def check(self, message: types.Message):
"""
If deep-linking is passed to the filter result of the matching will be passed as ``deep_link`` to the handler
:param message:
:return:
"""
check = await super(CommandStart, self).check(message)
if check and self... | [
"async",
"def",
"check",
"(",
"self",
",",
"message",
":",
"types",
".",
"Message",
")",
":",
"check",
"=",
"await",
"super",
"(",
"CommandStart",
",",
"self",
")",
".",
"check",
"(",
"message",
")",
"if",
"check",
"and",
"self",
".",
"deep_link",
"i... | If deep-linking is passed to the filter result of the matching will be passed as ``deep_link`` to the handler
:param message:
:return: | [
"If",
"deep",
"-",
"linking",
"is",
"passed",
"to",
"the",
"filter",
"result",
"of",
"the",
"matching",
"will",
"be",
"passed",
"as",
"deep_link",
"to",
"the",
"handler"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/dispatcher/filters/builtin.py#L155-L173 |
224,754 | aiogram/aiogram | aiogram/utils/parts.py | paginate | def paginate(data: typing.Iterable, page: int = 0, limit: int = 10) -> typing.Iterable:
"""
Slice data over pages
:param data: any iterable object
:type data: :obj:`typing.Iterable`
:param page: number of page
:type page: :obj:`int`
:param limit: items per page
:type limit: :obj:`int`
... | python | def paginate(data: typing.Iterable, page: int = 0, limit: int = 10) -> typing.Iterable:
"""
Slice data over pages
:param data: any iterable object
:type data: :obj:`typing.Iterable`
:param page: number of page
:type page: :obj:`int`
:param limit: items per page
:type limit: :obj:`int`
... | [
"def",
"paginate",
"(",
"data",
":",
"typing",
".",
"Iterable",
",",
"page",
":",
"int",
"=",
"0",
",",
"limit",
":",
"int",
"=",
"10",
")",
"->",
"typing",
".",
"Iterable",
":",
"return",
"data",
"[",
"page",
"*",
"limit",
":",
"page",
"*",
"lim... | Slice data over pages
:param data: any iterable object
:type data: :obj:`typing.Iterable`
:param page: number of page
:type page: :obj:`int`
:param limit: items per page
:type limit: :obj:`int`
:return: sliced object
:rtype: :obj:`typing.Iterable` | [
"Slice",
"data",
"over",
"pages"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/parts.py#L46-L59 |
224,755 | aiogram/aiogram | aiogram/bot/bot.py | Bot.download_file_by_id | async def download_file_by_id(self, file_id: base.String, destination=None,
timeout: base.Integer = 30, chunk_size: base.Integer = 65536,
seek: base.Boolean = True):
"""
Download file by file_id to destination
if You want to au... | python | async def download_file_by_id(self, file_id: base.String, destination=None,
timeout: base.Integer = 30, chunk_size: base.Integer = 65536,
seek: base.Boolean = True):
"""
Download file by file_id to destination
if You want to au... | [
"async",
"def",
"download_file_by_id",
"(",
"self",
",",
"file_id",
":",
"base",
".",
"String",
",",
"destination",
"=",
"None",
",",
"timeout",
":",
"base",
".",
"Integer",
"=",
"30",
",",
"chunk_size",
":",
"base",
".",
"Integer",
"=",
"65536",
",",
... | Download file by file_id to destination
if You want to automatically create destination (:class:`io.BytesIO`) use default
value of destination and handle result of this method.
:param file_id: str
:param destination: filename or instance of :class:`io.IOBase`. For e. g. :class:`io.Byte... | [
"Download",
"file",
"by",
"file_id",
"to",
"destination"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L42-L60 |
224,756 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_webhook_info | async def get_webhook_info(self) -> types.WebhookInfo:
"""
Use this method to get current webhook status. Requires no parameters.
If the bot is using getUpdates, will return an object with the url field empty.
Source: https://core.telegram.org/bots/api#getwebhookinfo
:return: ... | python | async def get_webhook_info(self) -> types.WebhookInfo:
"""
Use this method to get current webhook status. Requires no parameters.
If the bot is using getUpdates, will return an object with the url field empty.
Source: https://core.telegram.org/bots/api#getwebhookinfo
:return: ... | [
"async",
"def",
"get_webhook_info",
"(",
"self",
")",
"->",
"types",
".",
"WebhookInfo",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"locals",
"(",
")",
")",
"result",
"=",
"await",
"self",
".",
"request",
"(",
"api",
".",
"Methods",
".",
"... | Use this method to get current webhook status. Requires no parameters.
If the bot is using getUpdates, will return an object with the url field empty.
Source: https://core.telegram.org/bots/api#getwebhookinfo
:return: On success, returns a WebhookInfo object
:rtype: :obj:`types.Webhoo... | [
"Use",
"this",
"method",
"to",
"get",
"current",
"webhook",
"status",
".",
"Requires",
"no",
"parameters",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L144-L158 |
224,757 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_me | async def get_me(self) -> types.User:
"""
A simple method for testing your bot's auth token. Requires no parameters.
Source: https://core.telegram.org/bots/api#getme
:return: Returns basic information about the bot in form of a User object
:rtype: :obj:`types.User`
"""
... | python | async def get_me(self) -> types.User:
"""
A simple method for testing your bot's auth token. Requires no parameters.
Source: https://core.telegram.org/bots/api#getme
:return: Returns basic information about the bot in form of a User object
:rtype: :obj:`types.User`
"""
... | [
"async",
"def",
"get_me",
"(",
"self",
")",
"->",
"types",
".",
"User",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"locals",
"(",
")",
")",
"result",
"=",
"await",
"self",
".",
"request",
"(",
"api",
".",
"Methods",
".",
"GET_ME",
",",
... | A simple method for testing your bot's auth token. Requires no parameters.
Source: https://core.telegram.org/bots/api#getme
:return: Returns basic information about the bot in form of a User object
:rtype: :obj:`types.User` | [
"A",
"simple",
"method",
"for",
"testing",
"your",
"bot",
"s",
"auth",
"token",
".",
"Requires",
"no",
"parameters",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L163-L175 |
224,758 | aiogram/aiogram | aiogram/bot/bot.py | Bot.send_poll | async def send_poll(self, chat_id: typing.Union[base.Integer, base.String],
question: base.String,
options: typing.List[base.String],
disable_notification: typing.Optional[base.Boolean],
reply_to_message_id: typing.Union[bas... | python | async def send_poll(self, chat_id: typing.Union[base.Integer, base.String],
question: base.String,
options: typing.List[base.String],
disable_notification: typing.Optional[base.Boolean],
reply_to_message_id: typing.Union[bas... | [
"async",
"def",
"send_poll",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
",",
"question",
":",
"base",
".",
"String",
",",
"options",
":",
"typing",
".",
"List",
"[",
"base",... | Use this method to send a native poll. A native poll can't be sent to a private chat.
On success, the sent Message is returned.
:param chat_id: Unique identifier for the target chat
or username of the target channel (in the format @channelusername).
A native poll can't be sent t... | [
"Use",
"this",
"method",
"to",
"send",
"a",
"native",
"poll",
".",
"A",
"native",
"poll",
"can",
"t",
"be",
"sent",
"to",
"a",
"private",
"chat",
".",
"On",
"success",
"the",
"sent",
"Message",
"is",
"returned",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L850-L885 |
224,759 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_file | async def get_file(self, file_id: base.String) -> types.File:
"""
Use this method to get basic info about a file and prepare it for downloading.
For the moment, bots can download files of up to 20MB in size.
Note: This function may not preserve the original file name and MIME type.
... | python | async def get_file(self, file_id: base.String) -> types.File:
"""
Use this method to get basic info about a file and prepare it for downloading.
For the moment, bots can download files of up to 20MB in size.
Note: This function may not preserve the original file name and MIME type.
... | [
"async",
"def",
"get_file",
"(",
"self",
",",
"file_id",
":",
"base",
".",
"String",
")",
"->",
"types",
".",
"File",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"locals",
"(",
")",
")",
"result",
"=",
"await",
"self",
".",
"request",
"("... | Use this method to get basic info about a file and prepare it for downloading.
For the moment, bots can download files of up to 20MB in size.
Note: This function may not preserve the original file name and MIME type.
You should save the file's MIME type and name (if available) when the File obj... | [
"Use",
"this",
"method",
"to",
"get",
"basic",
"info",
"about",
"a",
"file",
"and",
"prepare",
"it",
"for",
"downloading",
".",
"For",
"the",
"moment",
"bots",
"can",
"download",
"files",
"of",
"up",
"to",
"20MB",
"in",
"size",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L932-L950 |
224,760 | aiogram/aiogram | aiogram/bot/bot.py | Bot.export_chat_invite_link | async def export_chat_invite_link(self, chat_id: typing.Union[base.Integer, base.String]) -> base.String:
"""
Use this method to generate a new invite link for a chat; any previously generated link is revoked.
The bot must be an administrator in the chat for this to work and must have the approp... | python | async def export_chat_invite_link(self, chat_id: typing.Union[base.Integer, base.String]) -> base.String:
"""
Use this method to generate a new invite link for a chat; any previously generated link is revoked.
The bot must be an administrator in the chat for this to work and must have the approp... | [
"async",
"def",
"export_chat_invite_link",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
")",
"->",
"base",
".",
"String",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
... | Use this method to generate a new invite link for a chat; any previously generated link is revoked.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://core.telegram.org/bots/api#exportchatinvitelink
:param chat_id: Unique i... | [
"Use",
"this",
"method",
"to",
"generate",
"a",
"new",
"invite",
"link",
"for",
"a",
"chat",
";",
"any",
"previously",
"generated",
"link",
"is",
"revoked",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1091-L1106 |
224,761 | aiogram/aiogram | aiogram/bot/bot.py | Bot.set_chat_photo | async def set_chat_photo(self, chat_id: typing.Union[base.Integer, base.String],
photo: base.InputFile) -> base.Boolean:
"""
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
The bot must be an administrator in the ch... | python | async def set_chat_photo(self, chat_id: typing.Union[base.Integer, base.String],
photo: base.InputFile) -> base.Boolean:
"""
Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
The bot must be an administrator in the ch... | [
"async",
"def",
"set_chat_photo",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
",",
"photo",
":",
"base",
".",
"InputFile",
")",
"->",
"base",
".",
"Boolean",
":",
"payload",
... | Use this method to set a new profile photo for the chat. Photos can't be changed for private chats.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Adm... | [
"Use",
"this",
"method",
"to",
"set",
"a",
"new",
"profile",
"photo",
"for",
"the",
"chat",
".",
"Photos",
"can",
"t",
"be",
"changed",
"for",
"private",
"chats",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1108-L1132 |
224,762 | aiogram/aiogram | aiogram/bot/bot.py | Bot.set_chat_description | async def set_chat_description(self, chat_id: typing.Union[base.Integer, base.String],
description: typing.Union[base.String, None] = None) -> base.Boolean:
"""
Use this method to change the description of a supergroup or a channel.
The bot must be an administr... | python | async def set_chat_description(self, chat_id: typing.Union[base.Integer, base.String],
description: typing.Union[base.String, None] = None) -> base.Boolean:
"""
Use this method to change the description of a supergroup or a channel.
The bot must be an administr... | [
"async",
"def",
"set_chat_description",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
",",
"description",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"String",
",",
"None",
"]... | Use this method to change the description of a supergroup or a channel.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://core.telegram.org/bots/api#setchatdescription
:param chat_id: Unique identifier for the target chat ... | [
"Use",
"this",
"method",
"to",
"change",
"the",
"description",
"of",
"a",
"supergroup",
"or",
"a",
"channel",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropr... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1177-L1195 |
224,763 | aiogram/aiogram | aiogram/bot/bot.py | Bot.unpin_chat_message | async def unpin_chat_message(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Boolean:
"""
Use this method to unpin a message in a supergroup chat.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://co... | python | async def unpin_chat_message(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Boolean:
"""
Use this method to unpin a message in a supergroup chat.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://co... | [
"async",
"def",
"unpin_chat_message",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
")",
"->",
"base",
".",
"Boolean",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"lo... | Use this method to unpin a message in a supergroup chat.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://core.telegram.org/bots/api#unpinchatmessage
:param chat_id: Unique identifier for the target chat or username of th... | [
"Use",
"this",
"method",
"to",
"unpin",
"a",
"message",
"in",
"a",
"supergroup",
"chat",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropriate",
"admin",
"righ... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1220-L1235 |
224,764 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_chat_administrators | async def get_chat_administrators(self, chat_id: typing.Union[base.Integer, base.String]
) -> typing.List[types.ChatMember]:
"""
Use this method to get a list of administrators in a chat.
Source: https://core.telegram.org/bots/api#getchatadministrators
... | python | async def get_chat_administrators(self, chat_id: typing.Union[base.Integer, base.String]
) -> typing.List[types.ChatMember]:
"""
Use this method to get a list of administrators in a chat.
Source: https://core.telegram.org/bots/api#getchatadministrators
... | [
"async",
"def",
"get_chat_administrators",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
")",
"->",
"typing",
".",
"List",
"[",
"types",
".",
"ChatMember",
"]",
":",
"payload",
"... | Use this method to get a list of administrators in a chat.
Source: https://core.telegram.org/bots/api#getchatadministrators
:param chat_id: Unique identifier for the target chat or username of the target supergroup or channel
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
... | [
"Use",
"this",
"method",
"to",
"get",
"a",
"list",
"of",
"administrators",
"in",
"a",
"chat",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1270-L1288 |
224,765 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_chat_member | async def get_chat_member(self, chat_id: typing.Union[base.Integer, base.String],
user_id: base.Integer) -> types.ChatMember:
"""
Use this method to get information about a member of a chat.
Source: https://core.telegram.org/bots/api#getchatmember
:param c... | python | async def get_chat_member(self, chat_id: typing.Union[base.Integer, base.String],
user_id: base.Integer) -> types.ChatMember:
"""
Use this method to get information about a member of a chat.
Source: https://core.telegram.org/bots/api#getchatmember
:param c... | [
"async",
"def",
"get_chat_member",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
",",
"user_id",
":",
"base",
".",
"Integer",
")",
"->",
"types",
".",
"ChatMember",
":",
"payload... | Use this method to get information about a member of a chat.
Source: https://core.telegram.org/bots/api#getchatmember
:param chat_id: Unique identifier for the target chat or username of the target supergroup or channel
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
:par... | [
"Use",
"this",
"method",
"to",
"get",
"information",
"about",
"a",
"member",
"of",
"a",
"chat",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1306-L1323 |
224,766 | aiogram/aiogram | aiogram/bot/bot.py | Bot.set_chat_sticker_set | async def set_chat_sticker_set(self, chat_id: typing.Union[base.Integer, base.String],
sticker_set_name: base.String) -> base.Boolean:
"""
Use this method to set a new group sticker set for a supergroup.
The bot must be an administrator in the chat for this to ... | python | async def set_chat_sticker_set(self, chat_id: typing.Union[base.Integer, base.String],
sticker_set_name: base.String) -> base.Boolean:
"""
Use this method to set a new group sticker set for a supergroup.
The bot must be an administrator in the chat for this to ... | [
"async",
"def",
"set_chat_sticker_set",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
",",
"sticker_set_name",
":",
"base",
".",
"String",
")",
"->",
"base",
".",
"Boolean",
":",
... | Use this method to set a new group sticker set for a supergroup.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Use the field can_set_sticker_set optionally returned in getChat requests to check
if the bot can use this method.
... | [
"Use",
"this",
"method",
"to",
"set",
"a",
"new",
"group",
"sticker",
"set",
"for",
"a",
"supergroup",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropriate",
... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1325-L1346 |
224,767 | aiogram/aiogram | aiogram/bot/bot.py | Bot.delete_chat_sticker_set | async def delete_chat_sticker_set(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Boolean:
"""
Use this method to delete a group sticker set from a supergroup.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Use t... | python | async def delete_chat_sticker_set(self, chat_id: typing.Union[base.Integer, base.String]) -> base.Boolean:
"""
Use this method to delete a group sticker set from a supergroup.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Use t... | [
"async",
"def",
"delete_chat_sticker_set",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"Integer",
",",
"base",
".",
"String",
"]",
")",
"->",
"base",
".",
"Boolean",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
... | Use this method to delete a group sticker set from a supergroup.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Use the field can_set_sticker_set optionally returned in getChat requests
to check if the bot can use this method.
... | [
"Use",
"this",
"method",
"to",
"delete",
"a",
"group",
"sticker",
"set",
"from",
"a",
"supergroup",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"appropriate",
"ad... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1348-L1366 |
224,768 | aiogram/aiogram | aiogram/bot/bot.py | Bot.stop_poll | async def stop_poll(self, chat_id: typing.Union[base.String, base.Integer],
message_id: base.Integer,
reply_markup: typing.Union[types.InlineKeyboardMarkup, None] = None) -> types.Poll:
"""
Use this method to stop a poll which was sent by the bot.
... | python | async def stop_poll(self, chat_id: typing.Union[base.String, base.Integer],
message_id: base.Integer,
reply_markup: typing.Union[types.InlineKeyboardMarkup, None] = None) -> types.Poll:
"""
Use this method to stop a poll which was sent by the bot.
... | [
"async",
"def",
"stop_poll",
"(",
"self",
",",
"chat_id",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"String",
",",
"base",
".",
"Integer",
"]",
",",
"message_id",
":",
"base",
".",
"Integer",
",",
"reply_markup",
":",
"typing",
".",
"Union",
"[",
... | Use this method to stop a poll which was sent by the bot.
On success, the stopped Poll with the final results is returned.
:param chat_id: Unique identifier for the target chat or username of the target channel
:type chat_id: :obj:`typing.Union[base.String, base.Integer]`
:param message... | [
"Use",
"this",
"method",
"to",
"stop",
"a",
"poll",
"which",
"was",
"sent",
"by",
"the",
"bot",
".",
"On",
"success",
"the",
"stopped",
"Poll",
"with",
"the",
"final",
"results",
"is",
"returned",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1564-L1583 |
224,769 | aiogram/aiogram | aiogram/bot/bot.py | Bot.get_sticker_set | async def get_sticker_set(self, name: base.String) -> types.StickerSet:
"""
Use this method to get a sticker set.
Source: https://core.telegram.org/bots/api#getstickerset
:param name: Name of the sticker set
:type name: :obj:`base.String`
:return: On success, a StickerS... | python | async def get_sticker_set(self, name: base.String) -> types.StickerSet:
"""
Use this method to get a sticker set.
Source: https://core.telegram.org/bots/api#getstickerset
:param name: Name of the sticker set
:type name: :obj:`base.String`
:return: On success, a StickerS... | [
"async",
"def",
"get_sticker_set",
"(",
"self",
",",
"name",
":",
"base",
".",
"String",
")",
"->",
"types",
".",
"StickerSet",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"locals",
"(",
")",
")",
"result",
"=",
"await",
"self",
".",
"reque... | Use this method to get a sticker set.
Source: https://core.telegram.org/bots/api#getstickerset
:param name: Name of the sticker set
:type name: :obj:`base.String`
:return: On success, a StickerSet object is returned
:rtype: :obj:`types.StickerSet` | [
"Use",
"this",
"method",
"to",
"get",
"a",
"sticker",
"set",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1649-L1663 |
224,770 | aiogram/aiogram | aiogram/bot/bot.py | Bot.create_new_sticker_set | async def create_new_sticker_set(self, user_id: base.Integer, name: base.String, title: base.String,
png_sticker: typing.Union[base.InputFile, base.String], emojis: base.String,
contains_masks: typing.Union[base.Boolean, None] = None,
... | python | async def create_new_sticker_set(self, user_id: base.Integer, name: base.String, title: base.String,
png_sticker: typing.Union[base.InputFile, base.String], emojis: base.String,
contains_masks: typing.Union[base.Boolean, None] = None,
... | [
"async",
"def",
"create_new_sticker_set",
"(",
"self",
",",
"user_id",
":",
"base",
".",
"Integer",
",",
"name",
":",
"base",
".",
"String",
",",
"title",
":",
"base",
".",
"String",
",",
"png_sticker",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"I... | Use this method to create new sticker set owned by a user. The bot will be able to edit the created sticker set.
Source: https://core.telegram.org/bots/api#createnewstickerset
:param user_id: User identifier of created sticker set owner
:type user_id: :obj:`base.Integer`
:param name: S... | [
"Use",
"this",
"method",
"to",
"create",
"new",
"sticker",
"set",
"owned",
"by",
"a",
"user",
".",
"The",
"bot",
"will",
"be",
"able",
"to",
"edit",
"the",
"created",
"sticker",
"set",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1688-L1722 |
224,771 | aiogram/aiogram | aiogram/bot/bot.py | Bot.set_sticker_position_in_set | async def set_sticker_position_in_set(self, sticker: base.String, position: base.Integer) -> base.Boolean:
"""
Use this method to move a sticker in a set created by the bot to a specific position.
Source: https://core.telegram.org/bots/api#setstickerpositioninset
:param sticker: File i... | python | async def set_sticker_position_in_set(self, sticker: base.String, position: base.Integer) -> base.Boolean:
"""
Use this method to move a sticker in a set created by the bot to a specific position.
Source: https://core.telegram.org/bots/api#setstickerpositioninset
:param sticker: File i... | [
"async",
"def",
"set_sticker_position_in_set",
"(",
"self",
",",
"sticker",
":",
"base",
".",
"String",
",",
"position",
":",
"base",
".",
"Integer",
")",
"->",
"base",
".",
"Boolean",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"locals",
"(",
... | Use this method to move a sticker in a set created by the bot to a specific position.
Source: https://core.telegram.org/bots/api#setstickerpositioninset
:param sticker: File identifier of the sticker
:type sticker: :obj:`base.String`
:param position: New sticker position in the set, ze... | [
"Use",
"this",
"method",
"to",
"move",
"a",
"sticker",
"in",
"a",
"set",
"created",
"by",
"the",
"bot",
"to",
"a",
"specific",
"position",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1755-L1771 |
224,772 | aiogram/aiogram | aiogram/bot/bot.py | Bot.delete_sticker_from_set | async def delete_sticker_from_set(self, sticker: base.String) -> base.Boolean:
"""
Use this method to delete a sticker from a set created by the bot.
The following methods and objects allow your bot to work in inline mode.
Source: https://core.telegram.org/bots/api#deletestickerfromset... | python | async def delete_sticker_from_set(self, sticker: base.String) -> base.Boolean:
"""
Use this method to delete a sticker from a set created by the bot.
The following methods and objects allow your bot to work in inline mode.
Source: https://core.telegram.org/bots/api#deletestickerfromset... | [
"async",
"def",
"delete_sticker_from_set",
"(",
"self",
",",
"sticker",
":",
"base",
".",
"String",
")",
"->",
"base",
".",
"Boolean",
":",
"payload",
"=",
"generate_payload",
"(",
"*",
"*",
"locals",
"(",
")",
")",
"result",
"=",
"await",
"self",
".",
... | Use this method to delete a sticker from a set created by the bot.
The following methods and objects allow your bot to work in inline mode.
Source: https://core.telegram.org/bots/api#deletestickerfromset
:param sticker: File identifier of the sticker
:type sticker: :obj:`base.String`
... | [
"Use",
"this",
"method",
"to",
"delete",
"a",
"sticker",
"from",
"a",
"set",
"created",
"by",
"the",
"bot",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1773-L1789 |
224,773 | aiogram/aiogram | aiogram/bot/bot.py | Bot.send_invoice | async def send_invoice(self, chat_id: base.Integer, title: base.String,
description: base.String, payload: base.String,
provider_token: base.String, start_parameter: base.String,
currency: base.String, prices: typing.List[types.LabeledPric... | python | async def send_invoice(self, chat_id: base.Integer, title: base.String,
description: base.String, payload: base.String,
provider_token: base.String, start_parameter: base.String,
currency: base.String, prices: typing.List[types.LabeledPric... | [
"async",
"def",
"send_invoice",
"(",
"self",
",",
"chat_id",
":",
"base",
".",
"Integer",
",",
"title",
":",
"base",
".",
"String",
",",
"description",
":",
"base",
".",
"String",
",",
"payload",
":",
"base",
".",
"String",
",",
"provider_token",
":",
... | Use this method to send invoices.
Source: https://core.telegram.org/bots/api#sendinvoice
:param chat_id: Unique identifier for the target private chat
:type chat_id: :obj:`base.Integer`
:param title: Product name, 1-32 characters
:type title: :obj:`base.String`
:param d... | [
"Use",
"this",
"method",
"to",
"send",
"invoices",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1838-L1914 |
224,774 | aiogram/aiogram | aiogram/bot/bot.py | Bot.answer_shipping_query | async def answer_shipping_query(self, shipping_query_id: base.String, ok: base.Boolean,
shipping_options: typing.Union[typing.List[types.ShippingOption], None] = None,
error_message: typing.Union[base.String, None] = None) -> base.Boolean:
... | python | async def answer_shipping_query(self, shipping_query_id: base.String, ok: base.Boolean,
shipping_options: typing.Union[typing.List[types.ShippingOption], None] = None,
error_message: typing.Union[base.String, None] = None) -> base.Boolean:
... | [
"async",
"def",
"answer_shipping_query",
"(",
"self",
",",
"shipping_query_id",
":",
"base",
".",
"String",
",",
"ok",
":",
"base",
".",
"Boolean",
",",
"shipping_options",
":",
"typing",
".",
"Union",
"[",
"typing",
".",
"List",
"[",
"types",
".",
"Shippi... | If you sent an invoice requesting a shipping address and the parameter is_flexible was specified,
the Bot API will send an Update with a shipping_query field to the bot.
Source: https://core.telegram.org/bots/api#answershippingquery
:param shipping_query_id: Unique identifier for the query to ... | [
"If",
"you",
"sent",
"an",
"invoice",
"requesting",
"a",
"shipping",
"address",
"and",
"the",
"parameter",
"is_flexible",
"was",
"specified",
"the",
"Bot",
"API",
"will",
"send",
"an",
"Update",
"with",
"a",
"shipping_query",
"field",
"to",
"the",
"bot",
"."... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1916-L1948 |
224,775 | aiogram/aiogram | aiogram/bot/bot.py | Bot.answer_pre_checkout_query | async def answer_pre_checkout_query(self, pre_checkout_query_id: base.String, ok: base.Boolean,
error_message: typing.Union[base.String, None] = None) -> base.Boolean:
"""
Once the user has confirmed their payment and shipping details,
the Bot API sends th... | python | async def answer_pre_checkout_query(self, pre_checkout_query_id: base.String, ok: base.Boolean,
error_message: typing.Union[base.String, None] = None) -> base.Boolean:
"""
Once the user has confirmed their payment and shipping details,
the Bot API sends th... | [
"async",
"def",
"answer_pre_checkout_query",
"(",
"self",
",",
"pre_checkout_query_id",
":",
"base",
".",
"String",
",",
"ok",
":",
"base",
".",
"Boolean",
",",
"error_message",
":",
"typing",
".",
"Union",
"[",
"base",
".",
"String",
",",
"None",
"]",
"="... | Once the user has confirmed their payment and shipping details,
the Bot API sends the final confirmation in the form of an Update with the field pre_checkout_query.
Use this method to respond to such pre-checkout queries.
Source: https://core.telegram.org/bots/api#answerprecheckoutquery
... | [
"Once",
"the",
"user",
"has",
"confirmed",
"their",
"payment",
"and",
"shipping",
"details",
"the",
"Bot",
"API",
"sends",
"the",
"final",
"confirmation",
"in",
"the",
"form",
"of",
"an",
"Update",
"with",
"the",
"field",
"pre_checkout_query",
".",
"Use",
"t... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/bot.py#L1950-L1976 |
224,776 | aiogram/aiogram | examples/callback_data_factory.py | get_keyboard | def get_keyboard() -> types.InlineKeyboardMarkup:
"""
Generate keyboard with list of posts
"""
markup = types.InlineKeyboardMarkup()
for post_id, post in POSTS.items():
markup.add(
types.InlineKeyboardButton(
post['title'],
callback_data=posts_cb.n... | python | def get_keyboard() -> types.InlineKeyboardMarkup:
"""
Generate keyboard with list of posts
"""
markup = types.InlineKeyboardMarkup()
for post_id, post in POSTS.items():
markup.add(
types.InlineKeyboardButton(
post['title'],
callback_data=posts_cb.n... | [
"def",
"get_keyboard",
"(",
")",
"->",
"types",
".",
"InlineKeyboardMarkup",
":",
"markup",
"=",
"types",
".",
"InlineKeyboardMarkup",
"(",
")",
"for",
"post_id",
",",
"post",
"in",
"POSTS",
".",
"items",
"(",
")",
":",
"markup",
".",
"add",
"(",
"types"... | Generate keyboard with list of posts | [
"Generate",
"keyboard",
"with",
"list",
"of",
"posts"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/examples/callback_data_factory.py#L36-L47 |
224,777 | aiogram/aiogram | aiogram/contrib/middlewares/i18n.py | I18nMiddleware.find_locales | def find_locales(self) -> Dict[str, gettext.GNUTranslations]:
"""
Load all compiled locales from path
:return: dict with locales
"""
translations = {}
for name in os.listdir(self.path):
if not os.path.isdir(os.path.join(self.path, name)):
con... | python | def find_locales(self) -> Dict[str, gettext.GNUTranslations]:
"""
Load all compiled locales from path
:return: dict with locales
"""
translations = {}
for name in os.listdir(self.path):
if not os.path.isdir(os.path.join(self.path, name)):
con... | [
"def",
"find_locales",
"(",
"self",
")",
"->",
"Dict",
"[",
"str",
",",
"gettext",
".",
"GNUTranslations",
"]",
":",
"translations",
"=",
"{",
"}",
"for",
"name",
"in",
"os",
".",
"listdir",
"(",
"self",
".",
"path",
")",
":",
"if",
"not",
"os",
".... | Load all compiled locales from path
:return: dict with locales | [
"Load",
"all",
"compiled",
"locales",
"from",
"path"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/contrib/middlewares/i18n.py#L45-L64 |
224,778 | aiogram/aiogram | aiogram/contrib/middlewares/i18n.py | I18nMiddleware.lazy_gettext | def lazy_gettext(self, singular, plural=None, n=1, locale=None) -> LazyProxy:
"""
Lazy get text
:param singular:
:param plural:
:param n:
:param locale:
:return:
"""
return LazyProxy(self.gettext, singular, plural, n, locale) | python | def lazy_gettext(self, singular, plural=None, n=1, locale=None) -> LazyProxy:
"""
Lazy get text
:param singular:
:param plural:
:param n:
:param locale:
:return:
"""
return LazyProxy(self.gettext, singular, plural, n, locale) | [
"def",
"lazy_gettext",
"(",
"self",
",",
"singular",
",",
"plural",
"=",
"None",
",",
"n",
"=",
"1",
",",
"locale",
"=",
"None",
")",
"->",
"LazyProxy",
":",
"return",
"LazyProxy",
"(",
"self",
".",
"gettext",
",",
"singular",
",",
"plural",
",",
"n"... | Lazy get text
:param singular:
:param plural:
:param n:
:param locale:
:return: | [
"Lazy",
"get",
"text"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/contrib/middlewares/i18n.py#L110-L120 |
224,779 | aiogram/aiogram | aiogram/utils/executor.py | Executor.on_startup | def on_startup(self, callback: callable, polling=True, webhook=True):
"""
Register a callback for the startup process
:param callback:
:param polling: use with polling
:param webhook: use with webhook
"""
self._check_frozen()
if not webhook and not pollin... | python | def on_startup(self, callback: callable, polling=True, webhook=True):
"""
Register a callback for the startup process
:param callback:
:param polling: use with polling
:param webhook: use with webhook
"""
self._check_frozen()
if not webhook and not pollin... | [
"def",
"on_startup",
"(",
"self",
",",
"callback",
":",
"callable",
",",
"polling",
"=",
"True",
",",
"webhook",
"=",
"True",
")",
":",
"self",
".",
"_check_frozen",
"(",
")",
"if",
"not",
"webhook",
"and",
"not",
"polling",
":",
"warn",
"(",
"'This ac... | Register a callback for the startup process
:param callback:
:param polling: use with polling
:param webhook: use with webhook | [
"Register",
"a",
"callback",
"for",
"the",
"startup",
"process"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/executor.py#L166-L187 |
224,780 | aiogram/aiogram | aiogram/utils/executor.py | Executor.on_shutdown | def on_shutdown(self, callback: callable, polling=True, webhook=True):
"""
Register a callback for the shutdown process
:param callback:
:param polling: use with polling
:param webhook: use with webhook
"""
self._check_frozen()
if not webhook and not poll... | python | def on_shutdown(self, callback: callable, polling=True, webhook=True):
"""
Register a callback for the shutdown process
:param callback:
:param polling: use with polling
:param webhook: use with webhook
"""
self._check_frozen()
if not webhook and not poll... | [
"def",
"on_shutdown",
"(",
"self",
",",
"callback",
":",
"callable",
",",
"polling",
"=",
"True",
",",
"webhook",
"=",
"True",
")",
":",
"self",
".",
"_check_frozen",
"(",
")",
"if",
"not",
"webhook",
"and",
"not",
"polling",
":",
"warn",
"(",
"'This a... | Register a callback for the shutdown process
:param callback:
:param polling: use with polling
:param webhook: use with webhook | [
"Register",
"a",
"callback",
"for",
"the",
"shutdown",
"process"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/executor.py#L189-L210 |
224,781 | aiogram/aiogram | setup.py | get_requirements | def get_requirements(filename=None):
"""
Read requirements from 'requirements txt'
:return: requirements
:rtype: list
"""
if filename is None:
filename = 'requirements.txt'
file = WORK_DIR / filename
install_reqs = parse_requirements(str(file), session='hack')
return [str(... | python | def get_requirements(filename=None):
"""
Read requirements from 'requirements txt'
:return: requirements
:rtype: list
"""
if filename is None:
filename = 'requirements.txt'
file = WORK_DIR / filename
install_reqs = parse_requirements(str(file), session='hack')
return [str(... | [
"def",
"get_requirements",
"(",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"filename",
"=",
"'requirements.txt'",
"file",
"=",
"WORK_DIR",
"/",
"filename",
"install_reqs",
"=",
"parse_requirements",
"(",
"str",
"(",
"file",
")",
... | Read requirements from 'requirements txt'
:return: requirements
:rtype: list | [
"Read",
"requirements",
"from",
"requirements",
"txt"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/setup.py#L45-L58 |
224,782 | aiogram/aiogram | aiogram/bot/base.py | BaseBot.request_timeout | def request_timeout(self, timeout):
"""
Context manager implements opportunity to change request timeout in current context
:param timeout:
:return:
"""
timeout = self._prepare_timeout(timeout)
token = self._ctx_timeout.set(timeout)
try:
yield... | python | def request_timeout(self, timeout):
"""
Context manager implements opportunity to change request timeout in current context
:param timeout:
:return:
"""
timeout = self._prepare_timeout(timeout)
token = self._ctx_timeout.set(timeout)
try:
yield... | [
"def",
"request_timeout",
"(",
"self",
",",
"timeout",
")",
":",
"timeout",
"=",
"self",
".",
"_prepare_timeout",
"(",
"timeout",
")",
"token",
"=",
"self",
".",
"_ctx_timeout",
".",
"set",
"(",
"timeout",
")",
"try",
":",
"yield",
"finally",
":",
"self"... | Context manager implements opportunity to change request timeout in current context
:param timeout:
:return: | [
"Context",
"manager",
"implements",
"opportunity",
"to",
"change",
"request",
"timeout",
"in",
"current",
"context"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/base.py#L124-L136 |
224,783 | aiogram/aiogram | aiogram/bot/base.py | BaseBot.request | async def request(self, method: base.String,
data: Optional[Dict] = None,
files: Optional[Dict] = None, **kwargs) -> Union[List, Dict, base.Boolean]:
"""
Make an request to Telegram Bot API
https://core.telegram.org/bots/api#making-requests
:... | python | async def request(self, method: base.String,
data: Optional[Dict] = None,
files: Optional[Dict] = None, **kwargs) -> Union[List, Dict, base.Boolean]:
"""
Make an request to Telegram Bot API
https://core.telegram.org/bots/api#making-requests
:... | [
"async",
"def",
"request",
"(",
"self",
",",
"method",
":",
"base",
".",
"String",
",",
"data",
":",
"Optional",
"[",
"Dict",
"]",
"=",
"None",
",",
"files",
":",
"Optional",
"[",
"Dict",
"]",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
"->",
"Uni... | Make an request to Telegram Bot API
https://core.telegram.org/bots/api#making-requests
:param method: API method
:type method: :obj:`str`
:param data: request parameters
:type data: :obj:`dict`
:param files: files
:type files: :obj:`dict`
:return: result... | [
"Make",
"an",
"request",
"to",
"Telegram",
"Bot",
"API"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/base.py#L144-L163 |
224,784 | aiogram/aiogram | aiogram/bot/base.py | BaseBot.download_file | async def download_file(self, file_path: base.String,
destination: Optional[base.InputFile] = None,
timeout: Optional[base.Integer] = sentinel,
chunk_size: Optional[base.Integer] = 65536,
seek: Optional[base.... | python | async def download_file(self, file_path: base.String,
destination: Optional[base.InputFile] = None,
timeout: Optional[base.Integer] = sentinel,
chunk_size: Optional[base.Integer] = 65536,
seek: Optional[base.... | [
"async",
"def",
"download_file",
"(",
"self",
",",
"file_path",
":",
"base",
".",
"String",
",",
"destination",
":",
"Optional",
"[",
"base",
".",
"InputFile",
"]",
"=",
"None",
",",
"timeout",
":",
"Optional",
"[",
"base",
".",
"Integer",
"]",
"=",
"s... | Download file by file_path to destination
if You want to automatically create destination (:class:`io.BytesIO`) use default
value of destination and handle result of this method.
:param file_path: file path on telegram server (You can get it from :obj:`aiogram.types.File`)
:type file_p... | [
"Download",
"file",
"by",
"file_path",
"to",
"destination"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/bot/base.py#L165-L199 |
224,785 | aiogram/aiogram | aiogram/types/fields.py | BaseField.get_value | def get_value(self, instance):
"""
Get value for the current object instance
:param instance:
:return:
"""
return instance.values.get(self.alias, self.default) | python | def get_value(self, instance):
"""
Get value for the current object instance
:param instance:
:return:
"""
return instance.values.get(self.alias, self.default) | [
"def",
"get_value",
"(",
"self",
",",
"instance",
")",
":",
"return",
"instance",
".",
"values",
".",
"get",
"(",
"self",
".",
"alias",
",",
"self",
".",
"default",
")"
] | Get value for the current object instance
:param instance:
:return: | [
"Get",
"value",
"for",
"the",
"current",
"object",
"instance"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/fields.py#L37-L44 |
224,786 | aiogram/aiogram | aiogram/types/fields.py | BaseField.set_value | def set_value(self, instance, value, parent=None):
"""
Set prop value
:param instance:
:param value:
:param parent:
:return:
"""
self.resolve_base(instance)
value = self.deserialize(value, parent)
instance.values[self.alias] = value
... | python | def set_value(self, instance, value, parent=None):
"""
Set prop value
:param instance:
:param value:
:param parent:
:return:
"""
self.resolve_base(instance)
value = self.deserialize(value, parent)
instance.values[self.alias] = value
... | [
"def",
"set_value",
"(",
"self",
",",
"instance",
",",
"value",
",",
"parent",
"=",
"None",
")",
":",
"self",
".",
"resolve_base",
"(",
"instance",
")",
"value",
"=",
"self",
".",
"deserialize",
"(",
"value",
",",
"parent",
")",
"instance",
".",
"value... | Set prop value
:param instance:
:param value:
:param parent:
:return: | [
"Set",
"prop",
"value"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/fields.py#L46-L58 |
224,787 | aiogram/aiogram | aiogram/types/base.py | TelegramObject.clean | def clean(self):
"""
Remove empty values
"""
for key, value in self.values.copy().items():
if value is None:
del self.values[key] | python | def clean(self):
"""
Remove empty values
"""
for key, value in self.values.copy().items():
if value is None:
del self.values[key] | [
"def",
"clean",
"(",
"self",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"values",
".",
"copy",
"(",
")",
".",
"items",
"(",
")",
":",
"if",
"value",
"is",
"None",
":",
"del",
"self",
".",
"values",
"[",
"key",
"]"
] | Remove empty values | [
"Remove",
"empty",
"values"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/base.py#L173-L179 |
224,788 | aiogram/aiogram | aiogram/types/chat.py | Chat.mention | def mention(self):
"""
Get mention if a Chat has a username, or get full name if this is a Private Chat, otherwise None is returned
"""
if self.username:
return '@' + self.username
if self.type == ChatType.PRIVATE:
return self.full_name
return None | python | def mention(self):
"""
Get mention if a Chat has a username, or get full name if this is a Private Chat, otherwise None is returned
"""
if self.username:
return '@' + self.username
if self.type == ChatType.PRIVATE:
return self.full_name
return None | [
"def",
"mention",
"(",
"self",
")",
":",
"if",
"self",
".",
"username",
":",
"return",
"'@'",
"+",
"self",
".",
"username",
"if",
"self",
".",
"type",
"==",
"ChatType",
".",
"PRIVATE",
":",
"return",
"self",
".",
"full_name",
"return",
"None"
] | Get mention if a Chat has a username, or get full name if this is a Private Chat, otherwise None is returned | [
"Get",
"mention",
"if",
"a",
"Chat",
"has",
"a",
"username",
"or",
"get",
"full",
"name",
"if",
"this",
"is",
"a",
"Private",
"Chat",
"otherwise",
"None",
"is",
"returned"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/chat.py#L46-L54 |
224,789 | aiogram/aiogram | aiogram/types/chat.py | Chat.update_chat | async def update_chat(self):
"""
User this method to update Chat data
:return: None
"""
other = await self.bot.get_chat(self.id)
for key, value in other:
self[key] = value | python | async def update_chat(self):
"""
User this method to update Chat data
:return: None
"""
other = await self.bot.get_chat(self.id)
for key, value in other:
self[key] = value | [
"async",
"def",
"update_chat",
"(",
"self",
")",
":",
"other",
"=",
"await",
"self",
".",
"bot",
".",
"get_chat",
"(",
"self",
".",
"id",
")",
"for",
"key",
",",
"value",
"in",
"other",
":",
"self",
"[",
"key",
"]",
"=",
"value"
] | User this method to update Chat data
:return: None | [
"User",
"this",
"method",
"to",
"update",
"Chat",
"data"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/chat.py#L90-L99 |
224,790 | aiogram/aiogram | aiogram/types/chat.py | Chat.export_invite_link | async def export_invite_link(self):
"""
Use this method to export an invite link to a supergroup or a channel.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://core.telegram.org/bots/api#exportchatinvitelink
... | python | async def export_invite_link(self):
"""
Use this method to export an invite link to a supergroup or a channel.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://core.telegram.org/bots/api#exportchatinvitelink
... | [
"async",
"def",
"export_invite_link",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"invite_link",
":",
"self",
".",
"invite_link",
"=",
"await",
"self",
".",
"bot",
".",
"export_chat_invite_link",
"(",
"self",
".",
"id",
")",
"return",
"self",
".",
"... | Use this method to export an invite link to a supergroup or a channel.
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
Source: https://core.telegram.org/bots/api#exportchatinvitelink
:return: Returns exported invite link as String on su... | [
"Use",
"this",
"method",
"to",
"export",
"an",
"invite",
"link",
"to",
"a",
"supergroup",
"or",
"a",
"channel",
".",
"The",
"bot",
"must",
"be",
"an",
"administrator",
"in",
"the",
"chat",
"for",
"this",
"to",
"work",
"and",
"must",
"have",
"the",
"app... | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/chat.py#L387-L400 |
224,791 | aiogram/aiogram | aiogram/types/chat.py | ChatType.is_group_or_super_group | def is_group_or_super_group(cls, obj) -> bool:
"""
Check chat is group or super-group
:param obj:
:return:
"""
return cls._check(obj, [cls.GROUP, cls.SUPER_GROUP]) | python | def is_group_or_super_group(cls, obj) -> bool:
"""
Check chat is group or super-group
:param obj:
:return:
"""
return cls._check(obj, [cls.GROUP, cls.SUPER_GROUP]) | [
"def",
"is_group_or_super_group",
"(",
"cls",
",",
"obj",
")",
"->",
"bool",
":",
"return",
"cls",
".",
"_check",
"(",
"obj",
",",
"[",
"cls",
".",
"GROUP",
",",
"cls",
".",
"SUPER_GROUP",
"]",
")"
] | Check chat is group or super-group
:param obj:
:return: | [
"Check",
"chat",
"is",
"group",
"or",
"super",
"-",
"group"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/chat.py#L462-L469 |
224,792 | aiogram/aiogram | aiogram/types/message_entity.py | MessageEntity.get_text | def get_text(self, text):
"""
Get value of entity
:param text: full text
:return: part of text
"""
if sys.maxunicode == 0xffff:
return text[self.offset:self.offset + self.length]
if not isinstance(text, bytes):
entity_text = text.encode('... | python | def get_text(self, text):
"""
Get value of entity
:param text: full text
:return: part of text
"""
if sys.maxunicode == 0xffff:
return text[self.offset:self.offset + self.length]
if not isinstance(text, bytes):
entity_text = text.encode('... | [
"def",
"get_text",
"(",
"self",
",",
"text",
")",
":",
"if",
"sys",
".",
"maxunicode",
"==",
"0xffff",
":",
"return",
"text",
"[",
"self",
".",
"offset",
":",
"self",
".",
"offset",
"+",
"self",
".",
"length",
"]",
"if",
"not",
"isinstance",
"(",
"... | Get value of entity
:param text: full text
:return: part of text | [
"Get",
"value",
"of",
"entity"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message_entity.py#L21-L37 |
224,793 | aiogram/aiogram | aiogram/types/message_entity.py | MessageEntity.parse | def parse(self, text, as_html=True):
"""
Get entity value with markup
:param text: original text
:param as_html: as html?
:return: entity text with markup
"""
if not text:
return text
entity_text = self.get_text(text)
if self.type == ... | python | def parse(self, text, as_html=True):
"""
Get entity value with markup
:param text: original text
:param as_html: as html?
:return: entity text with markup
"""
if not text:
return text
entity_text = self.get_text(text)
if self.type == ... | [
"def",
"parse",
"(",
"self",
",",
"text",
",",
"as_html",
"=",
"True",
")",
":",
"if",
"not",
"text",
":",
"return",
"text",
"entity_text",
"=",
"self",
".",
"get_text",
"(",
"text",
")",
"if",
"self",
".",
"type",
"==",
"MessageEntityType",
".",
"BO... | Get entity value with markup
:param text: original text
:param as_html: as html?
:return: entity text with markup | [
"Get",
"entity",
"value",
"with",
"markup"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/types/message_entity.py#L39-L77 |
224,794 | aiogram/aiogram | aiogram/utils/payload.py | _normalize | def _normalize(obj):
"""
Normalize dicts and lists
:param obj:
:return: normalized object
"""
if isinstance(obj, list):
return [_normalize(item) for item in obj]
elif isinstance(obj, dict):
return {k: _normalize(v) for k, v in obj.items() if v is not None}
elif hasattr(o... | python | def _normalize(obj):
"""
Normalize dicts and lists
:param obj:
:return: normalized object
"""
if isinstance(obj, list):
return [_normalize(item) for item in obj]
elif isinstance(obj, dict):
return {k: _normalize(v) for k, v in obj.items() if v is not None}
elif hasattr(o... | [
"def",
"_normalize",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"list",
")",
":",
"return",
"[",
"_normalize",
"(",
"item",
")",
"for",
"item",
"in",
"obj",
"]",
"elif",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"return",
"{"... | Normalize dicts and lists
:param obj:
:return: normalized object | [
"Normalize",
"dicts",
"and",
"lists"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/payload.py#L30-L43 |
224,795 | aiogram/aiogram | aiogram/utils/helper.py | HelperMode._screaming_snake_case | def _screaming_snake_case(cls, text):
"""
Transform text to SCREAMING_SNAKE_CASE
:param text:
:return:
"""
if text.isupper():
return text
result = ''
for pos, symbol in enumerate(text):
if symbol.isupper() and pos > 0:
... | python | def _screaming_snake_case(cls, text):
"""
Transform text to SCREAMING_SNAKE_CASE
:param text:
:return:
"""
if text.isupper():
return text
result = ''
for pos, symbol in enumerate(text):
if symbol.isupper() and pos > 0:
... | [
"def",
"_screaming_snake_case",
"(",
"cls",
",",
"text",
")",
":",
"if",
"text",
".",
"isupper",
"(",
")",
":",
"return",
"text",
"result",
"=",
"''",
"for",
"pos",
",",
"symbol",
"in",
"enumerate",
"(",
"text",
")",
":",
"if",
"symbol",
".",
"isuppe... | Transform text to SCREAMING_SNAKE_CASE
:param text:
:return: | [
"Transform",
"text",
"to",
"SCREAMING_SNAKE_CASE"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/helper.py#L59-L74 |
224,796 | aiogram/aiogram | aiogram/utils/helper.py | HelperMode._camel_case | def _camel_case(cls, text, first_upper=False):
"""
Transform text to camelCase or CamelCase
:param text:
:param first_upper: first symbol must be upper?
:return:
"""
result = ''
need_upper = False
for pos, symbol in enumerate(text):
if... | python | def _camel_case(cls, text, first_upper=False):
"""
Transform text to camelCase or CamelCase
:param text:
:param first_upper: first symbol must be upper?
:return:
"""
result = ''
need_upper = False
for pos, symbol in enumerate(text):
if... | [
"def",
"_camel_case",
"(",
"cls",
",",
"text",
",",
"first_upper",
"=",
"False",
")",
":",
"result",
"=",
"''",
"need_upper",
"=",
"False",
"for",
"pos",
",",
"symbol",
"in",
"enumerate",
"(",
"text",
")",
":",
"if",
"symbol",
"==",
"'_'",
"and",
"po... | Transform text to camelCase or CamelCase
:param text:
:param first_upper: first symbol must be upper?
:return: | [
"Transform",
"text",
"to",
"camelCase",
"or",
"CamelCase"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/helper.py#L89-L110 |
224,797 | aiogram/aiogram | aiogram/utils/helper.py | HelperMode.apply | def apply(cls, text, mode):
"""
Apply mode for text
:param text:
:param mode:
:return:
"""
if mode == cls.SCREAMING_SNAKE_CASE:
return cls._screaming_snake_case(text)
elif mode == cls.snake_case:
return cls._snake_case(text)
... | python | def apply(cls, text, mode):
"""
Apply mode for text
:param text:
:param mode:
:return:
"""
if mode == cls.SCREAMING_SNAKE_CASE:
return cls._screaming_snake_case(text)
elif mode == cls.snake_case:
return cls._snake_case(text)
... | [
"def",
"apply",
"(",
"cls",
",",
"text",
",",
"mode",
")",
":",
"if",
"mode",
"==",
"cls",
".",
"SCREAMING_SNAKE_CASE",
":",
"return",
"cls",
".",
"_screaming_snake_case",
"(",
"text",
")",
"elif",
"mode",
"==",
"cls",
".",
"snake_case",
":",
"return",
... | Apply mode for text
:param text:
:param mode:
:return: | [
"Apply",
"mode",
"for",
"text"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/utils/helper.py#L113-L133 |
224,798 | aiogram/aiogram | aiogram/contrib/middlewares/logging.py | LoggingFilter.filter | def filter(self, record: logging.LogRecord):
"""
Extend LogRecord by data from Telegram Update object.
:param record:
:return:
"""
update = types.Update.get_current(True)
if update:
for key, value in self.make_prefix(self.prefix, self.process_update(u... | python | def filter(self, record: logging.LogRecord):
"""
Extend LogRecord by data from Telegram Update object.
:param record:
:return:
"""
update = types.Update.get_current(True)
if update:
for key, value in self.make_prefix(self.prefix, self.process_update(u... | [
"def",
"filter",
"(",
"self",
",",
"record",
":",
"logging",
".",
"LogRecord",
")",
":",
"update",
"=",
"types",
".",
"Update",
".",
"get_current",
"(",
"True",
")",
"if",
"update",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"make_prefix",
"... | Extend LogRecord by data from Telegram Update object.
:param record:
:return: | [
"Extend",
"LogRecord",
"by",
"data",
"from",
"Telegram",
"Update",
"object",
"."
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/contrib/middlewares/logging.py#L182-L194 |
224,799 | aiogram/aiogram | aiogram/contrib/middlewares/logging.py | LoggingFilter.process_update | def process_update(self, update: types.Update):
"""
Parse Update object
:param update:
:return:
"""
yield 'update_id', update.update_id
if update.message:
yield 'update_type', 'message'
yield from self.process_message(update.message)
... | python | def process_update(self, update: types.Update):
"""
Parse Update object
:param update:
:return:
"""
yield 'update_id', update.update_id
if update.message:
yield 'update_type', 'message'
yield from self.process_message(update.message)
... | [
"def",
"process_update",
"(",
"self",
",",
"update",
":",
"types",
".",
"Update",
")",
":",
"yield",
"'update_id'",
",",
"update",
".",
"update_id",
"if",
"update",
".",
"message",
":",
"yield",
"'update_type'",
",",
"'message'",
"yield",
"from",
"self",
"... | Parse Update object
:param update:
:return: | [
"Parse",
"Update",
"object"
] | 2af930149ce2482547721e2c8755c10307295e48 | https://github.com/aiogram/aiogram/blob/2af930149ce2482547721e2c8755c10307295e48/aiogram/contrib/middlewares/logging.py#L196-L231 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.