How to use the deltachat.const.DC_MSG_AUDIO function in deltachat

To help you get started, we’ve selected a few deltachat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deltachat / deltabot / plugins / simplebot_mastodon / simplebot_mastodon / __init__.py View on Github external
def toot(cls, ctx, acc, visibility=None, in_reply_to=None):
        m = cls.get_session(acc)
        if ctx.msg.is_image() or ctx.msg.is_gif() or ctx.msg.is_video() or ctx.msg._view_type in (dc.const.DC_MSG_AUDIO, dc.const.DC_MSG_VOICE):
            if ctx.msg.filename.endswith('.aac'):
                aac_file = AudioSegment.from_file(ctx.msg.filename, 'aac')
                filename = ctx.msg.filename[:-4]+'.mp3'
                aac_file.export(filename, format='mp3')
            else:
                filename = ctx.msg.filename
            media = [m.media_post(filename).id]
            if in_reply_to:
                m.status_reply(m.status(in_reply_to), ctx.text,
                               media_ids=media, visibility=visibility)
            else:
                m.status_post(ctx.text, media_ids=media, visibility=visibility)
        elif ctx.text:
            if in_reply_to:
                m.status_reply(m.status(in_reply_to),
                               ctx.text, visibility=visibility)