dronefly-garden / dronefly

Red Discord Bot V3 cogs for naturalists.
Other
16 stars 3 forks source link

iNat: Auto-preview observation links. #37

Closed synrg closed 4 years ago

synrg commented 5 years ago

The current inat link command has serious usability issues. I propose to solve this by supporting auto-previewing of observation links so that users can do what is most natural: simply paste a link to the channel, and the bot will respond with supplemental info about the auto-previewed image.

One solution to suppressing the auto-preview by Discord is to simply disable auto-previews either across the whole server or per channel. However, our server doesn't want to do that, as Discord's auto-previews are useful for non-observation links. It would take a lot of extra work & put a lot of extra burden on the bot to have to get in the middle and handle all auto-previews itself, which would be the only way to make this approach acceptable for our server.

Therefore, I propose to have an on_message hook that, when enabled, auto-previews any observation links in the current channel via link. This would need to be coupled with a modification to the default behaviour of link, which should normally omit the image, since Discord will always provide it. The link command itself can be kept for these cases:

One refinement to this would be to support a variant of the link command that, despite having included the link in <...> to suppress the image preview, would nevertheless include the image preview, i.e.

synrg commented 5 years ago

Note that with the introduction of the [p]obs command, I've already gone a different way than to change [p]link as per above.

Also, with https://github.com/synrg/dronefly/issues/47 in mind, the different behaviours for previewed/not-previewed images does not have to be solved with different commands for those two bot actions. Instead, when on_message spots a link it knows how to preview, it should just let Discord do its thing and focus on previewing anything Discord didn't include (i.e. leave the image intact; reformat the title line to suit our desires, and supplement the description with info from iNat record fields: who/when/where, etc.)

synrg commented 5 years ago

There should be reasonable fallbacks if the required permissions aren't granted to the bot. So, if it can't edit the user's message, it should output one of its own. And if it can't generate an embed, it should output text.

synrg commented 4 years ago

This feature was delivered a while ago & is managed via inat autoobs subcommands.