if message.from_user.id not in base:
*код для добавления в базу данных*
message.photo[0].file_id
btnSendVideo.addEventListener('click',(e) =>{
let links = []
e.preventDefault()
let formData = new FormData(videoForm)
formData.delete("csrf_token")
for(let [name, value] of formData){
links.push(value)
}
let data = JSON.stringify({"link": links})
let response = $.ajax({
method: 'POST',
url: "http://127.0.0.1:8080/video",
data: data,
headers:{ "Content-Type": "application/json"}
})
})
#Получение названия тека и запрос медиа
@dp.message_handler(content_types=['photo', 'video'], state=FSMAdmin.media)
async def load_media(message: types.Message, state: FSMContext):
async with state.proxy() as data:
try:
data['media'] = message.photo[0].file_id
except:
data['media'] = message.video.file_id
await FSMAdmin.next()
await message.reply("Теперь пришли название песни")
margin-left: 96.5%;
@media screen and (max-width: 723px){
.burger__menu{
display: flex;
justify-content: flex-end;
position: absolute;
width: 23px;
height: 15px;
cursor: pointer;
margin-left: 95%;
top: 8.37%;
}
}
@media screen and (max-width: 482px){
.burger__menu{
display: flex;
justify-content: flex-end;
position: absolute;
width: 23px;
height: 15px;
cursor: pointer;
margin-left: 90%;
top: 8.37%;
}
}
delo = user.get_delo_by_text(message.text)
deluga = telebot.types.InlineKeyboardMarkup(row_width=2)
deluga.add(telebot.types. InlineKeyboardButton(text='Выполнить', callback_data=f'completed_{delo.delo_id}'))
deluga.add(telebot.types.InlineKeyboardButton(text='Удалить', callback_data=f'delete_{delo.delo_id}'))
bot.send_message(message.chat.id, message.text, reply_markup=deluga)
@bot.callback_query_handler(func=lambda call: True)
def callback_key(call):
user = User.get_user(call.message.chat.id)
if user is None:
user = User(call.message.chat.id)
if 'completed_' in call.data:
bot.answer_callback_query(call.id, 'Задание выполнено!')
delo_id = call.data.replace('completed_', '')
delo = user.get_delo_by_id(delo_id)
delo.status = delo.STATUS_COMPLETED
if 'delete_' in call.data:
bot.answer_callback_query(call.id, 'Задание удалено.')
delo_id = call.data.replace('delete_', '')
delo = user.get_delo_by_id(delo_id)
delo.status = delo.STATUS_DELETE