mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2025-12-29 17:44:50 +00:00
This commit fixes the style issues introduced in 95ecce1 according to the output
from black and isort.
Details: https://deepsource.io/gh/yasirarism/MissKatyPyro/transform/2b5c318f-57d7-4419-8e76-1d6c31d72999/
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
import asyncio
|
|
from logging import getLogger
|
|
|
|
from pyrogram.errors import ChatWriteForbidden, FloodWait, MessageNotModified
|
|
|
|
LOGGER = getLogger(__name__)
|
|
|
|
# handler for TG function, so need write exception in every code
|
|
|
|
|
|
async def kirimPesan(msg, text: str, disable_web_page_preview=True, reply_markup=None):
|
|
try:
|
|
return await msg.reply(text)
|
|
except FloodWait as e:
|
|
LOGGER.warning(str(e))
|
|
await asyncio.sleep(e.value)
|
|
return await kirimPesan(text)
|
|
except ChatWriteForbidden:
|
|
return await msg.leave()
|
|
except Exception as e:
|
|
LOGGER.error(str(e))
|
|
|
|
|
|
async def editPesan(msg, text: str, disable_web_page_preview=True, reply_markup=None):
|
|
try:
|
|
return await msg.edit(text)
|
|
except FloodWait as e:
|
|
LOGGER.warning(str(e))
|
|
await asyncio.sleep(e.value)
|
|
return await editPesan(msg, text)
|
|
except MessageNotModified:
|
|
return
|
|
except Exception as e:
|
|
LOGGER.error(str(e))
|
|
|
|
|
|
async def hapusPesan(msg):
|
|
try:
|
|
return await msg.delete()
|
|
except FloodWait as e:
|
|
LOGGER.warning(str(e))
|
|
await asyncio.sleep(e.value)
|
|
return await hapusPesan(msg)
|
|
except Exception as e:
|
|
LOGGER.error(str(e))
|