mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-13 02:19:54 +00:00
Merge pull request #12 from surik00/dev-1.x
Minor typos fixes + ReplyKeyboardMarkup.insert method fix
This commit is contained in:
commit
7fa12fc80e
8 changed files with 21 additions and 22 deletions
|
|
@ -1,13 +1,12 @@
|
||||||
import asyncio
|
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
|
import logging
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
from .. import types
|
from .. import types
|
||||||
from ..utils import exceptions
|
|
||||||
from ..utils import json
|
from ..utils import json
|
||||||
|
from ..utils import exceptions
|
||||||
from ..utils.helper import Helper, HelperMode, Item
|
from ..utils.helper import Helper, HelperMode, Item
|
||||||
|
|
||||||
# Main aiogram logger
|
# Main aiogram logger
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ class Chat(base.TelegramObject):
|
||||||
@property
|
@property
|
||||||
def mention(self):
|
def mention(self):
|
||||||
"""
|
"""
|
||||||
Get mention if dialog have username or full name if this is Private dialog otherwise None
|
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:
|
if self.username:
|
||||||
return '@' + self.username
|
return '@' + self.username
|
||||||
|
|
@ -51,7 +51,7 @@ class Chat(base.TelegramObject):
|
||||||
@property
|
@property
|
||||||
def user_url(self):
|
def user_url(self):
|
||||||
if self.type != ChatType.PRIVATE:
|
if self.type != ChatType.PRIVATE:
|
||||||
raise TypeError('This property available only in private chats.')
|
raise TypeError('`user_url` property is only available in private chats!')
|
||||||
|
|
||||||
return f"tg://user?id={self.id}"
|
return f"tg://user?id={self.id}"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ class BaseField(metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
:param base: class for child element
|
:param base: class for child element
|
||||||
:param default: default value
|
:param default: default value
|
||||||
:param alias: alias name (for e.g. field named 'from' must be has name 'from_user'
|
:param alias: alias name (for e.g. field 'from' has to be named 'from_user'
|
||||||
('from' is builtin Python keyword)
|
as 'from' is a builtin Python keyword
|
||||||
"""
|
"""
|
||||||
self.base_object = base
|
self.base_object = base
|
||||||
self.default = default
|
self.default = default
|
||||||
|
|
@ -34,7 +34,7 @@ class BaseField(metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
def get_value(self, instance):
|
def get_value(self, instance):
|
||||||
"""
|
"""
|
||||||
Get value for current object instance
|
Get value for the current object instance
|
||||||
|
|
||||||
:param instance:
|
:param instance:
|
||||||
:return:
|
:return:
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class ReplyKeyboardMarkup(base.TelegramObject):
|
||||||
|
|
||||||
:param button:
|
:param button:
|
||||||
"""
|
"""
|
||||||
if self.keyboard and len(self.keyboard[-1] < self.row_width):
|
if self.keyboard and len(self.keyboard[-1]) < self.row_width:
|
||||||
self.keyboard[-1].append(button)
|
self.keyboard[-1].append(button)
|
||||||
else:
|
else:
|
||||||
self.add(button)
|
self.add(button)
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,13 @@ dp = Dispatcher(bot)
|
||||||
|
|
||||||
@dp.message_handler(commands=['start'])
|
@dp.message_handler(commands=['start'])
|
||||||
async def send_welcome(message: types.Message):
|
async def send_welcome(message: types.Message):
|
||||||
# So... By first i want to send something like that:
|
# So... At first I want to send something like this:
|
||||||
await message.reply("Do you want to see many pussies? Are you ready?")
|
await message.reply("Do you want to see many pussies? Are you ready?")
|
||||||
|
|
||||||
# And wait few seconds...
|
# And wait few seconds...
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
|
|
||||||
# Good bots always must be send chat actions. Or not.
|
# Good bots should send chat actions. Or not.
|
||||||
await ChatActions.upload_photo()
|
await ChatActions.upload_photo()
|
||||||
|
|
||||||
# Create media group
|
# Create media group
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue