Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent currency conversion bangs? #153

Open
robinmetral opened this issue Jan 24, 2025 · 4 comments · Fixed by #156
Open

Consistent currency conversion bangs? #153

robinmetral opened this issue Jan 24, 2025 · 4 comments · Fixed by #156
Labels
enhancement New feature or request

Comments

@robinmetral
Copy link

Is your feature request related to a problem? Please describe.
There are currently 20 bangs redirecting to xe.com for currency conversion.1 For example:

{
    "s": "XE (AUD2EUR)",
    "d": "www.xe.com",
    "t": "AUD2EUR",
    "u": "https://www.xe.com/currencyconverter/convert/?Amount={{{s}}}&From=AUD&To=EUR",
    "c": "Online Services",
    "sc": "Tools"
}

As far as I can tell, all 20 bangs follow the pattern: !<curA>2<curB> 👉 https://www.xe.com/currencyconverter/convert/?Amount={{{s}}}&From=<curA>&To=<curB>, with curA and curB being ISO 4217 3-letter currency codes.

However, as a bangs user, there is no way to know which currency bang will exist, and which will not. For example, !aud2eur 10 successfully redirects to xe.com to convert 10 AUD to EUR, but the opposite conversion !eur2aud 10 does not (the bang doesn't exist).

Is it somehow possible to make all currency conversion bangs work as expected?

Describe the solution you'd like
Cover all currency conversions. It's probably not feasible to hardcode all possible !<curA>2<curB> bangs to bangs.json, so we'd either need to add logic in the repo and generate them (creates more complexity), or to find a creative way to get a single bang to cover all conversions.

Note that this is more of an open question than an actual feature request, and also to give visibility to the problem (that currency conversion bangs aren't consistent right now).

Additional context
n/a

Footnotes

  1. one bang, !xe, redirects to https://xe.com/currency/{{{s}}}, which 404s.

@robinmetral robinmetral added the enhancement New feature or request label Jan 24, 2025
@utopiatopia
Copy link
Contributor

utopiatopia commented Feb 1, 2025

I did some napkin math, and that'd increase the number of bangs by a LOT. We're talking 26k (1.85x current bang count). I'll get a PR in later this afternoon, just to see if Margret feels like merging it.

@nobodywasishere
Copy link
Member

I think it'd be worth it to add currency conversions for the top 10(?) or so currencies if they don't already exist (not removing any that currently exist). That'd bring the total currency conversion bangs to 100, which is a lot more reasonable. Otherwise it gets into tricky territory where I want to shy away from creating a lot of bangs that no one will ever use, and will increase the size of the bangs json file substantially.

I have been thinking about changing the bangs json format to allow for things like multiple triggers for the same bang and doing region autocomplete - maybe there could be something similar to that for this.

@robinmetral
Copy link
Author

Top n currencies is what I had in mind at first, but how do you define what a "top" currency is? Amount traded? Population of countries that use the currencies?

@z64
Copy link
Member

z64 commented Feb 26, 2025

Another thing we have been thinking about is allowing you to supply a regex with capture groups that is used when the bang's trigger is matched. This would allow you to effectively do "argument parsing" on the bang and sort the capture groups into different parameters, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants