mirror of
https://github.com/MuRuLOSE/limoka.git
synced 2026-06-18 15:14:18 +02:00
clear histroy
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
# requires: whoosh cryptography
|
# requires: whoosh cryptography
|
||||||
|
|
||||||
|
|
||||||
|
import datetime
|
||||||
from whoosh.index import create_in, open_dir
|
from whoosh.index import create_in, open_dir
|
||||||
from whoosh.fields import Schema, TEXT, ID
|
from whoosh.fields import Schema, TEXT, ID
|
||||||
from whoosh.qparser import QueryParser, OrGroup
|
from whoosh.qparser import QueryParser, OrGroup
|
||||||
@@ -20,6 +21,7 @@ from telethon.types import Message
|
|||||||
from telethon.errors.rpcerrorlist import WebpageMediaEmptyError
|
from telethon.errors.rpcerrorlist import WebpageMediaEmptyError
|
||||||
from telethon import TelegramClient
|
from telethon import TelegramClient
|
||||||
from telethon.errors.rpcerrorlist import YouBlockedUserError
|
from telethon.errors.rpcerrorlist import YouBlockedUserError
|
||||||
|
from telethon import functions, types
|
||||||
try:
|
try:
|
||||||
from aiogram.utils.exceptions import BadRequest
|
from aiogram.utils.exceptions import BadRequest
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -414,6 +416,13 @@ class Limoka(loader.Module):
|
|||||||
if not message:
|
if not message:
|
||||||
message = await self.client.send_message(self._bot_username, "/start")
|
message = await self.client.send_message(self._bot_username, "/start")
|
||||||
await message.delete()
|
await message.delete()
|
||||||
|
await self.client(functions.messages.DeleteHistoryRequest(
|
||||||
|
peer=self._bot_username,
|
||||||
|
max_id=0,
|
||||||
|
just_clear=True,
|
||||||
|
revoke=True,
|
||||||
|
))
|
||||||
|
|
||||||
except YouBlockedUserError:
|
except YouBlockedUserError:
|
||||||
logger.warning(f"Please unblock {self._bot_username} to enable external installation feature. Or disable external_install_allowed in Limoka settings to get rid of this message.")
|
logger.warning(f"Please unblock {self._bot_username} to enable external installation feature. Or disable external_install_allowed in Limoka settings to get rid of this message.")
|
||||||
self._userbot_bot_username = (await self.inline.bot.get_me()).username
|
self._userbot_bot_username = (await self.inline.bot.get_me()).username
|
||||||
|
|||||||
Reference in New Issue
Block a user