forked from uniborg/uniborg
catch exceptions when the title isnt modified
This commit is contained in:
parent
dbbd02edc8
commit
4d531be35b
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue