From 4d531be35b90f83963b22b78e54a25bc7f5abf51 Mon Sep 17 00:00:00 2001 From: udf Date: Thu, 22 Nov 2018 16:02:48 +0200 Subject: [PATCH] catch exceptions when the title isnt modified --- stdplugins/sp_prog_rename.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/stdplugins/sp_prog_rename.py b/stdplugins/sp_prog_rename.py index 0031b32..985f63a 100644 --- a/stdplugins/sp_prog_rename.py +++ b/stdplugins/sp_prog_rename.py @@ -3,6 +3,7 @@ import re from telethon import events from telethon.tl.functions.channels import EditTitleRequest +from telethon.errors.rpcerrorlist import ChatNotModifiedError MULTI_EDIT_TIMEOUT = 80 REVERT_TIMEOUT = 2 * 60 * 60 @@ -26,9 +27,12 @@ async def edit_title(title): global prog_tech_channel if prog_tech_channel is None: prog_tech_channel = await borg.get_entity(CHANNEL_ID) - await borg(EditTitleRequest( - channel=prog_tech_channel, title=title - )) + try: + await borg(EditTitleRequest( + channel=prog_tech_channel, title=title + )) + except ChatNotModifiedError: + pass # Everything is ok async def wait_for_delete(deleted_fut, timeout):