Skip to content

Bug: /coin command returns incorrect cryptocurrency names for major tokens #29

@AccursedGalaxy

Description

@AccursedGalaxy

Description

When using the /coin command for major cryptocurrencies, the bot returns incorrect names:

  • /coin BTC returns "BlackrockTradingCurrency (BTC)" instead of "Bitcoin (BTC)"
  • /coin ETH returns "The Infinite Garden (ETH)" instead of "Ethereum (ETH)"

This appears to be an issue with how we're querying and handling the CoinGecko API response in the coin command.

Current Behavior

image
image

The bot currently:

  1. Takes the first match from the CoinGecko API response
  2. Doesn't prioritize or validate major cryptocurrency tickers
  3. Returns potentially misleading or incorrect information for well-known cryptocurrencies

Expected Behavior

  • /coin BTC should return "Bitcoin (BTC)"
  • /coin ETH should return "Ethereum (ETH)"
  • Other major cryptocurrencies should return their commonly known names

Relevant Code

The issue likely originates in the coin command implementation:

@commands.slash_command(
    name="coin",
    description="Gets stats about a cryptocurrency. - usage: /coin <ticker> - example: /coin btc",
)
async def coin(self, inter: disnake.ApplicationCommandInteraction, ticker: str):
    # Current implementation doesn't validate or prioritize major cryptocurrencies
    coin_data = await fetch_coin_info(ticker)

The fetch_coin_info function needs to be modified to either:

  1. Prioritize major cryptocurrencies
  2. Use a mapping for common tickers
  3. Implement better search/matching logic

Possible Solutions

  1. Create a mapping of major cryptocurrency tickers to their CoinGecko IDs:
MAJOR_COINS = {
    "BTC": "bitcoin",
    "ETH": "ethereum",
    # Add other major coins
}
  1. Modify the fetch_coin_info function to check this mapping first:
async def fetch_coin_info(ticker: str):
    ticker = ticker.lower()
    if ticker in MAJOR_COINS:
        return await coingecko_api.get_coin_by_id(MAJOR_COINS[ticker])
    # Fallback to current search logic
    return await current_search_implementation(ticker)

Additional Context

  • This affects user experience as it provides misleading information for the most commonly searched cryptocurrencies
  • The current implementation might be pulling data from tokens that share the same ticker symbol
  • Priority should be given to established cryptocurrencies over newer tokens with the same ticker

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions