1
0
mirror of https://gitlab.com/simple-stock-bots/simple-stock-bot.git synced 2025-06-16 15:17:28 +00:00

update status commmand

This commit is contained in:
Anson 2023-09-04 04:23:30 +00:00
parent c72978fcac
commit 7b471fcc67
3 changed files with 5 additions and 5 deletions

View File

@ -103,7 +103,7 @@ class MarketData:
) )
status.raise_for_status() status.raise_for_status()
except r.HTTPError: except r.HTTPError:
return f"API returned an HTTP error code {status.status_code} in {status.elapsed.total_seconds()} Seconds." return f"API returned an HTTP error code {status.status_code} in {status.elapsed.total_seconds()} seconds."
except r.Timeout: except r.Timeout:
return "API timed out before it was able to give status. This is likely due to a surge in usage or a complete outage." return "API timed out before it was able to give status. This is likely due to a surge in usage or a complete outage."
@ -111,7 +111,7 @@ class MarketData:
if statusJSON["status"] == "ok": if statusJSON["status"] == "ok":
return ( return (
f"CoinGecko API responded that it was OK with a {status.status_code} in {status.elapsed.total_seconds()} Seconds." f"CoinGecko API responded that it was OK with a {status.status_code} in {status.elapsed.total_seconds()} seconds."
) )
else: else:
return f"MarketData.app is currently reporting the following status: {statusJSON['status']}" return f"MarketData.app is currently reporting the following status: {statusJSON['status']}"

View File

@ -77,10 +77,10 @@ class cg_Crypto:
try: try:
status.raise_for_status() status.raise_for_status()
return ( return (
f"CoinGecko API responded that it was OK with a {status.status_code} in {status.elapsed.total_seconds()} Seconds." f"CoinGecko API responded that it was OK with a {status.status_code} in {status.elapsed.total_seconds()} seconds."
) )
except r.HTTPError: except r.HTTPError:
return f"CoinGecko API returned an error code {status.status_code} in {status.elapsed.total_seconds()} Seconds." return f"CoinGecko API returned an error code {status.status_code} in {status.elapsed.total_seconds()} seconds."
def price_reply(self, coin: Coin) -> str: def price_reply(self, coin: Coin) -> str:
"""Returns current market price or after hours if its available for a given coin symbol. """Returns current market price or after hours if its available for a given coin symbol.

View File

@ -42,7 +42,7 @@ async def status(ctx: commands):
message = "" message = ""
try: try:
message = "Contact MisterBiggs#0465 if you need help.\n" message = "Contact MisterBiggs#0465 if you need help.\n"
message += s.status(f"Bot recieved your message in: {bot.latency*1000:.4f}ms") + "\n" message += s.status(f"Bot recieved your message in: {bot.latency*10:.4f} seconds") + "\n"
except Exception as ex: except Exception as ex:
logging.critical(ex) logging.critical(ex)