dev@locazia: fixes
This commit is contained in:
1 parent
a03ec3d61d
commit
039abb5703
3 files changed
+20
-9
No files matched your search
@@ -112,17 +112,26 @@ class Wrapped_CBotChat(T, PlayerTemplates):
|
||||
|
||||
async def delete_message(self, message_id):
|
||||
assert self._chat_id, "No chat_id"
|
||||
message_id = int(message_id)
|
||||
try:
|
||||
make_log(self, f"Delete message {self._chat_id}/{message_id}", level='debug')
|
||||
return await self._bot.delete_message(
|
||||
if (await self._bot.delete_message(
|
||||
self._chat_id,
|
||||
message_id
|
||||
)
|
||||
)):
|
||||
if self.db_session:
|
||||
known_message = self.db_session.query(KnownTelegramMessage).filter(
|
||||
KnownTelegramMessage.chat_id == self._chat_id,
|
||||
KnownTelegramMessage.message_id == message_id
|
||||
).first()
|
||||
if known_message:
|
||||
known_message.deleted = True
|
||||
self.db_session.commit()
|
||||
except Exception as e:
|
||||
make_log(self, f"Error deleting message {self._chat_id}/{message_id}. Error: {e}", level='warning')
|
||||
return None
|
||||
|
||||
async def send_photo(self, file_id, message_type='common', message_meta={}, **kwargs):
|
||||
async def send_photo(self, file_id, message_type='common', message_meta={}, content_id=None, **kwargs):
|
||||
assert self._chat_id, "No chat_id"
|
||||
try:
|
||||
make_log(self, f"Send photo to {self._chat_id}. File: {file_id}", level='debug')
|
||||
@@ -136,7 +145,7 @@ class Wrapped_CBotChat(T, PlayerTemplates):
|
||||
make_log(self, f"Error sending photo to {self._chat_id}. Error: {e}", level='warning')
|
||||
return None
|
||||
|
||||
async def send_document(self, file_id, message_type='common', message_meta={}, **kwargs):
|
||||
async def send_document(self, file_id, message_type='common', message_meta={}, content_id=None, **kwargs):
|
||||
assert self._chat_id, "No chat_id"
|
||||
try:
|
||||
make_log(self, f"Send document to {self._chat_id}. File: {file_id}", level='debug')
|
||||
@@ -150,7 +159,7 @@ class Wrapped_CBotChat(T, PlayerTemplates):
|
||||
make_log(self, f"Error sending document to {self._chat_id}. Error: {e}", level='warning')
|
||||
return None
|
||||
|
||||
async def send_video(self, file_id, message_type='common', message_meta={}, **kwargs):
|
||||
async def send_video(self, file_id, message_type='common', message_meta={}, content_id=None, **kwargs):
|
||||
assert self._chat_id, "No chat_id"
|
||||
try:
|
||||
make_log(self, f"Send video to {self._chat_id}. File: {file_id}", level='debug')
|
||||
@@ -164,7 +173,7 @@ class Wrapped_CBotChat(T, PlayerTemplates):
|
||||
make_log(self, f"Error sending video to {self._chat_id}. Error: {e}", level='warning')
|
||||
return None
|
||||
|
||||
async def send_audio(self, file_id, message_type='common', message_meta={}, **kwargs):
|
||||
async def send_audio(self, file_id, message_type='common', message_meta={}, content_id=None, **kwargs):
|
||||
assert self._chat_id, "No chat_id"
|
||||
try:
|
||||
make_log(self, f"Send audio to {self._chat_id}. File: {file_id}", level='debug')
|
||||
|
||||
Reference in new issue
Block a user