'<a href="tg://user?id= + msg.chat.id + ">msg.chat.first_name</a>'
msg.from.id
, msg.from.first_name
aiogram > bot > base.py
в функции get_new_session
в ClientSession добавить trust_env=True
aiogram > bot > api.py
в функции make_request
в запросе установить ssl = False
def generate_file_payload(exclude=None, **kwargs):
"""
Generate payload
:param exclude:
:param kwargs:
:return: dict
"""
if exclude is None:
exclude = ['file_path']
data = FormData()
for key, value in kwargs.items():
if key not in exclude + DEFAULT_FILTER and value is not None and not key.startswith('_'):
data.add_field(''.join([key.split('_')[0].lower(), *map(str.title, key.split('_')[1:])]), str(value))
if key == 'file_path':
file_path = str(value).replace('\\', '/')
data.add_field('uploadFile',
open(str(value), 'rb'),
filename=file_path.split('/')[-1], content_type='multipart/form-data')
return data
final += chr(summa % 32 + 1040)
INSERT INTO users (user_id, user_nickname) VALUES (?, ?)
if "/тест" in msg:
user_nickname = sql.fetchone(f"SELECT user_nicknameFROM users WHERE user_id= '{user_id}'")
if user_nickname is not None:
vk_session.method('messages.send', {'chat_id':id, "message" : f"{user_nickname}", 'random_id' : 0})
types.InputMediaPhoto
импортируйте types.MediaGroup
media = types.MediaGroup()
for x in list_photo_ids:
media.attach_photo(x, 'Подпись к фото если нужно')
bot.send_media_group(message.chat.id, media=media_group, caption='Текст к сообщению с фото')
id, username, file_ids, text
await storage.set_state(chat=chat_id,
user = chat_id,
state=state)