dronefly-garden / dronefly

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

place: support place code prefix search order #75

Closed synrg closed 4 years ago

synrg commented 4 years ago

This feature would supplement #74 in order to make it less cumbersome to users in a particular region of the world.

The idea is to support a comma-delimited list of country-prefixes to try if the user typed a 2-character code for a place so that the first matching code would be used, (& with a special value '=' meaning the 2-character code itself to indicate a country, not a state, province, or territory).

A possible interface for this mod-only command would be:

[p]place set search us-,ca-,=,au-,mx-

Which would establish this search order for 2-character codes:

  1. try prefix with us-
  2. try prefix with ca-
  3. try the code itself
  4. try prefix with au-
  5. try prefix with mx-

If none of these successfully matched a place that has its abbreviation already added to the bot's table, the 2 characters would be looked up against the iNat /v1/places/autocomplete endpoint as the final fallback (i.e. the currently implemented behaviour).

In other parts of the world, a different search order (e.g. maybe "=" first) might make more sense. That could be configured per guild, depending on where the majority of their users are making observations. In an international community, a per-user search order might be desirable, which could be set as per the above interface, except DM-ing the bot instead.

synrg commented 4 years ago

Don't forget counties & districts (e.g. Ontario has both). It seems doubtful many would know our learn to use the codes for those, though. So an in qualifier would help here.

synrg commented 4 years ago

No plans to do this one. Can be reopened later if we change our minds.