catch exceptions when the title isnt modified

This commit is contained in:
udf 2018-11-22 16:02:48 +02:00
parent dbbd02edc8
commit 4d531be35b
Signed by: kate
GPG Key ID: E40724BAD73AF77B
1 changed files with 7 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import re
from telethon import events from telethon import events
from telethon.tl.functions.channels import EditTitleRequest from telethon.tl.functions.channels import EditTitleRequest
from telethon.errors.rpcerrorlist import ChatNotModifiedError
MULTI_EDIT_TIMEOUT = 80 MULTI_EDIT_TIMEOUT = 80
REVERT_TIMEOUT = 2 * 60 * 60 REVERT_TIMEOUT = 2 * 60 * 60
@ -26,9 +27,12 @@ async def edit_title(title):
global prog_tech_channel global prog_tech_channel
if prog_tech_channel is None: if prog_tech_channel is None:
prog_tech_channel = await borg.get_entity(CHANNEL_ID) prog_tech_channel = await borg.get_entity(CHANNEL_ID)
try:
await borg(EditTitleRequest( await borg(EditTitleRequest(
channel=prog_tech_channel, title=title channel=prog_tech_channel, title=title
)) ))
except ChatNotModifiedError:
pass # Everything is ok
async def wait_for_delete(deleted_fut, timeout): async def wait_for_delete(deleted_fut, timeout):