mirror of
https://github.com/MrSedan/neuro-reply-bot-reworked.git
synced 2026-01-14 13:39:42 +03:00
Message edit by its order
This commit is contained in:
@@ -76,6 +76,20 @@ class AdminCommands(Handler):
|
||||
"_", "\_").replace('.', '\.').replace(',', '\,').replace('!', '\!').replace('-', '\-').replace(':', '\:').replace('+', '\+'), parse_mode='markdownv2')
|
||||
await message.answer(res2, entities=posts_entities)
|
||||
|
||||
#TODO: Сделать изменение Message Entities
|
||||
@self.router.message(Command('edit'))
|
||||
async def edit_post_by_order_num(message: types.Message):
|
||||
command = message.text.split(' ', 2)
|
||||
print(command)
|
||||
if len(command)<3:
|
||||
await message.reply('Недостаточно аргементов!')
|
||||
return
|
||||
try:
|
||||
await neuroapi.post.edit_text_by_order_num(command[1], command[2])
|
||||
await message.reply(f'Текст поста успешно изменен на: {command[2]}')
|
||||
except Exception as e:
|
||||
await message.reply(f'Ошибка: {e}')
|
||||
|
||||
"""
|
||||
TODO: Изменение постов сделать нормально, не через редактирование сообщений
|
||||
@self.router.message(ChangePosts())
|
||||
|
||||
@@ -72,6 +72,13 @@ class Post(ApiMethod):
|
||||
raise Exception(data['message'])
|
||||
return neuroTypes.Post.from_dict(data)
|
||||
|
||||
async def edit_text_by_order_num(self, order: str, text: str):
|
||||
response = requests.post(self.api_url + f"/post/edit-post-by-order-num/{order}", data={"text": text})
|
||||
data = response.json()
|
||||
if 'statusCode' in data:
|
||||
raise Exception(data['message'])
|
||||
return neuroTypes.Post.from_dict(data)
|
||||
|
||||
async def get_post_to_post(self):
|
||||
response = requests.get(self.api_url+f"/post/post")
|
||||
data = response.json()
|
||||
|
||||
Reference in New Issue
Block a user