dronefly-garden / dronefly

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

obs: Bot response not expected #113

Closed michaelpirrello closed 4 years ago

michaelpirrello commented 4 years ago

"obs #" provokes a bot response (when no , is used to trigger the bot)

synrg commented 4 years ago

The underlying issue here is that OBS_LINK_PAT (which autoobs feature uses to locate links) deliberately looks for obs # in the message. I'm not sure why I added that, but vaguely recall I had some particular use case for that pattern elsewhere in mind. Clearly it shouldn't affect autoobs, though, so I agree it should be fixed (though tbh, it's pretty low in my priorities considering it isn't likely to be triggered, and the behaviour is not that obnoxious).

synrg commented 4 years ago

Fixed in ded81bcf17eedb521ce7625dc407bac1e99cb270 in replace-pyparsing branch.

synrg commented 4 years ago

The reason for cmd_obs_id being matched (obs #) was for the benefit of [p]last obs so it could say the message was shared "by [name]". The fix undoes that feature by searching for the URL in the embed produced by the bot in response to a link being shared (e.g. via autoobs). Now it only outputs the relative timestamp (e.g. "15 minutes ago").

This is a necessary fix, however, in order to allow [p]last obs to work with obs embeds that are produced as the result of a [p]search obs or [p]obs command without any URL specified, as in those cases, the observation id & URL are not present in whatever the user typed. Instead, we now look inside the resulting embed the bot produces.

synrg commented 4 years ago

Fixed in master in 9e9e814afc71d7002e6ab5dbfba46e99034fa409.