Skip to content

[FAQ] send multimedia message

Housa Hitomi edited this page Apr 15, 2022 · 4 revisions

TL;DR

  1. send KMarkdown
@bot.command()
async def multimedia(msg: Message):
    await msg.reply('''(spl)some secret(spl)''', type=MessageTypes.KMD)
  1. send image
@bot.command()
async def multimedia(msg: Message):
    await msg.reply('https://link.to/your/image', type=MessageTypes.IMG)

for more msg types, please refer to MessageTypes

when send/reply IMG/VIDEO/AUDIO etc. multimedia message, the content should be filled with a link str

how to upload image/audio etc.

@bot.command()
async def foo(m: Message, b: Bot):
    url = await b.create_asset(open('/path/to/your/file', 'rb'))
    await m.reply(url, type=MessageTypes.IMG)