I am making a bot that converts media.xxxx.net into cdn.xxxx.com links. This works perfectly for videos but as a side effect, it also converts images which is an undesirable effect.
One way would explicitly tell the bot which formats (mp4, MOV etc) to convert and leave the other formats but considering the amount of formats there are for video file, I think it is necessary but I can't come up with any other way.
Here is the code I wrote
if message.content.startswith('https://media') and not message.content.endswith('jpg') and not message.content.endswith('png') and not message.content.endswith('gif') and not message.content.endswith('webp'):
message.content.replace('media', 'cdn').replace('net', 'com')
await message.delete()
Here I was trying to make the bot ignore the most common picture formats but it is just looking like a mess as I add more and more formats.