Add fix for audio files sending as voice notes

master
Dan Elkouby 2019-11-04 18:41:25 +00:00
parent a6ea92b859
commit 0ca6f4eebd
1 changed files with 24 additions and 0 deletions

24
stdplugins/music_fix.py Normal file
View File

@ -0,0 +1,24 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from telethon import events
@borg.on(events.NewMessage(outgoing=True))
async def _(e):
if e.fwd_from or e.via_bot_id:
return
if e.voice:
f = e.file
if f.title and f.performer:
caption = f"{f.performer} - {f.title}"
elif f.title:
caption = f.title
elif f.name:
caption = f.name
else:
caption = None
if caption:
await e.edit(caption)