From ec0a755aece9854e1df0048ff52146025b493f02 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Sat, 30 Oct 2021 19:53:00 +0100 Subject: [PATCH] Improve discord help command (#881) --- discordbot/economy/economy_menu.py | 17 ++- discordbot/generic_commands.py | 109 +++++++++--------- .../stocks/dark_pool_shorts/dps_menu.py | 20 +++- 3 files changed, 81 insertions(+), 65 deletions(-) diff --git a/discordbot/economy/economy_menu.py b/discordbot/economy/economy_menu.py index b5ea1752bd9..e9b0fc4c28a 100644 --- a/discordbot/economy/economy_menu.py +++ b/discordbot/economy/economy_menu.py @@ -1,7 +1,6 @@ -import discord import asyncio +import discord import config_discordbot as cfg -from discordbot import gst_bot from economy.feargreed import feargreed_command from economy.overview import overview_command @@ -12,6 +11,7 @@ from economy.glbonds import glbonds_command from economy.currencies import currencies_command from economy.valuation import valuation_command from economy.performance import performance_command +from discordbot import gst_bot class EconomyCommands(discord.ext.commands.Cog): @@ -22,43 +22,52 @@ class EconomyCommands(discord.ext.commands.Cog): @discord.ext.commands.command(name="economy.feargreed") async def feargreed(self, ctx: discord.ext.commands.Context, arg=""): + """CNN Fear and Greed Index [CNN]""" await feargreed_command(ctx, arg) @discord.ext.commands.command(name="economy.overview") async def overview(self, ctx: discord.ext.commands.Context, arg=""): + """Market data overview [Wall St. Journal]""" await overview_command(ctx, arg) @discord.ext.commands.command(name="economy.indices") async def indices(self, ctx: discord.ext.commands.Context, arg=""): + """US indices overview [Wall St. Journal]""" await indices_command(ctx, arg) @discord.ext.commands.command(name="economy.futures") async def futures(self, ctx: discord.ext.commands.Context, arg=""): + """Futures and commodities overview [Wall St. Journal]""" await futures_command(ctx, arg) @discord.ext.commands.command(name="economy.usbonds") async def usbonds(self, ctx: discord.ext.commands.Context, arg=""): + """US bonds overview [Wall St. Journal]""" await usbonds_command(ctx, arg) @discord.ext.commands.command(name="economy.glbonds") async def glbonds(self, ctx: discord.ext.commands.Context, arg=""): + """Global bonds overview [Wall St. Journal]""" await glbonds_command(ctx, arg) @discord.ext.commands.command(name="economy.currencies") async def currencies(self, ctx: discord.ext.commands.Context, arg=""): + """Currencies overview [Wall St. Journal]""" await currencies_command(ctx, arg) @discord.ext.commands.command(name="economy.valuation") async def valuation(self, ctx: discord.ext.commands.Context, arg=""): + """Valuation of sectors, industry, country [Finviz]""" await valuation_command(ctx, arg) @discord.ext.commands.command(name="economy.performance") async def performance(self, ctx: discord.ext.commands.Context, arg=""): + """Performance of sectors, industry, country [Finviz]""" await performance_command(ctx, arg) @discord.ext.commands.command(name="economy") async def economy(self, ctx: discord.ext.commands.Context): - """Shows Economy Menu + """Economy Context Menu Returns ------- @@ -98,7 +107,7 @@ class EconomyCommands(discord.ext.commands.Cog): return user == ctx.message.author and str(reaction.emoji) in emoji_list try: - reaction, user = await gst_bot.wait_for( + reaction, _ = await gst_bot.wait_for( "reaction_add", timeout=cfg.MENU_TIMEOUT, check=check ) if reaction.emoji == "0️⃣": diff --git a/discordbot/generic_commands.py b/discordbot/generic_commands.py index 64b505c8812..cbd1bc876e3 100644 --- a/discordbot/generic_commands.py +++ b/discordbot/generic_commands.py @@ -1,55 +1,54 @@ -import discord -import config_discordbot as cfg - - -class GenericCommands(discord.ext.commands.Cog): - """Generic discord.ext.commands.""" - - def __init__(self, bot: discord.ext.commands.Bot): - self.bot = bot - - @discord.ext.commands.command(name="about") - async def hello_world(self, ctx: discord.ext.commands.Context): - links = ( - "Join our community on discord: https://discord.gg/Up2QGbMKHY\n" - "Follow our twitter for updates: https://twitter.com/gamestonkt\n" - "Access our landing page: https://gamestonkterminal.vercel.app\n\n" - "**Maintainers:** DidierRLopes, jmaslek, aia\n" - ) - partnerships = ( - "FinBrain: https://finbrain.tech\n" - "Quiver Quantitative: https://www.quiverquant.com\n" - "Ops.Syncretism: https://ops.syncretism.io/api.html\n" - "SentimentInvestor: https://sentimentinvestor.com\n" - "The Geek of Wall Street: https://thegeekofwallstreet.com\n" - ) - disclaimer = ( - "Trading in financial instruments involves high risks including " - "the risk of losing some, or all, of your investment amount, and " - "may not be suitable for all investors. Before deciding to trade " - "in financial instrument you should be fully informed of the risks " - "and costs associated with trading the financial markets, carefully " - "consider your investment objectives, level of experience, and risk " - "appetite, and seek professional advice where needed. The data " - "contained in Gamestonk Terminal (GST) is not necessarily accurate. " - "GST and any provider of the data contained in this website will not " - "accept liability for any loss or damage as a result of your trading, " - "or your reliance on the information displayed." - ) - embed = discord.Embed( - title="Investment Research for Everyone", - description=links, - colour=cfg.COLOR, - ) - embed.set_author( - name=cfg.AUTHOR_NAME, - icon_url=cfg.AUTHOR_ICON_URL, - ) - embed.add_field(name="Partnerships:", value=partnerships, inline=False) - embed.add_field(name="Disclaimer:", value=disclaimer, inline=False) - - await ctx.send(embed=embed) - - -def setup(bot: discord.ext.commands.Bot): - bot.add_cog(GenericCommands(bot)) +import discord +import config_discordbot as cfg + + +class GenericCommands(discord.ext.commands.Cog): + """Generic discord.ext.commands.""" + + def __init__(self, bot: discord.ext.commands.Bot): + self.bot = bot + + @discord.ext.commands.command(name="about") + async def about(self, ctx: discord.ext.commands.Context): + """About Gamestonk Terminal""" + links = ( + "Join our community on discord: https://discord.gg/Up2QGbMKHY\n" + "Follow our twitter for updates: https://twitter.com/gamestonkt\n" + "Access our landing page: https://gamestonkterminal.vercel.app\n\n" + "**Main maintainers:** DidierRLopes, jmaslek, aia\n" + ) + partnerships = ( + "FinBrain: https://finbrain.tech\n" + "Quiver Quantitative: https://www.quiverquant.com\n" + "SentimentInvestor: https://sentimentinvestor.com\n" + ) + disclaimer = ( + "Trading in financial instruments involves high risks including " + "the risk of losing some, or all, of your investment amount, and " + "may not be suitable for all investors. Before deciding to trade " + "in financial instrument you should be fully informed of the risks " + "and costs associated with trading the financial markets, carefully " + "consider your investment objectives, level of experience, and risk " + "appetite, and seek professional advice where needed. The data " + "contained in Gamestonk Terminal (GST) is not necessarily accurate. " + "GST and any provider of the data contained in this website will not " + "accept liability for any loss or damage as a result of your trading, " + "or your reliance on the information displayed." + ) + embed = discord.Embed( + title="Investment Research for Everyone", + description=links, + colour=cfg.COLOR, + ) + embed.set_author( + name=cfg.AUTHOR_NAME, + icon_url=cfg.AUTHOR_ICON_URL, + ) + embed.add_field(name="Partnerships:", value=partnerships, inline=False) + embed.add_field(name="Disclaimer:", value=disclaimer, inline=False) + + await ctx.send(embed=embed) + + +def setup(bot: discord.ext.commands.Bot): + bot.add_cog(GenericCommands(bot)) diff --git a/discordbot/stocks/dark_pool_shorts/dps_menu.py b/discordbot/stocks/dark_pool_shorts/dps_menu.py index c2e44bb4158..37eaa98ef25 100644 --- a/discordbot/stocks/dark_pool_shorts/dps_menu.py +++ b/discordbot/stocks/dark_pool_shorts/dps_menu.py @@ -1,7 +1,6 @@ -import discord -from discordbot import gst_bot -import config_discordbot as cfg import asyncio +import discord +import config_discordbot as cfg from stocks.dark_pool_shorts.shorted import shorted_command from stocks.dark_pool_shorts.ftd import ftd_command @@ -11,49 +10,58 @@ from stocks.dark_pool_shorts.psi import psi_command from stocks.dark_pool_shorts.hsi import hsi_command from stocks.dark_pool_shorts.pos import pos_command from stocks.dark_pool_shorts.sidtc import sidtc_command +from discordbot import gst_bot class DarkPoolShortsCommands(discord.ext.commands.Cog): - """Dark Pool Shorts menu.""" + """Dark Pool Shorts menu""" def __init__(self, bot: discord.ext.commands.Bot): self.bot = bot @discord.ext.commands.command(name="stocks.dps.shorted") async def shorted(self, ctx: discord.ext.commands.Context, arg=""): + """Show most shorted stocks [Yahoo Finance]""" await shorted_command(ctx, arg) @discord.ext.commands.command(name="stocks.dps.hsi") async def hsi(self, ctx: discord.ext.commands.Context, arg=""): + """Show top high short interest stocks of over 20% ratio [shortinterest.com]""" await hsi_command(ctx, arg) @discord.ext.commands.command(name="stocks.dps.pos") async def pos(self, ctx: discord.ext.commands.Context, arg="", arg2=""): + """Dark pool short position [Stockgrid]""" await pos_command(ctx, arg, arg2) @discord.ext.commands.command(name="stocks.dps.sidtc") async def sidtc(self, ctx: discord.ext.commands.Context, arg="", arg2=""): + """Short interest and days to cover [Stockgrid]""" await sidtc_command(ctx, arg, arg2) @discord.ext.commands.command(name="stocks.dps.ftd") async def ftd(self, ctx: discord.ext.commands.Context, arg, arg2="", arg3=""): + """Fails-to-deliver data [SEC]""" await ftd_command(ctx, arg, arg2, arg3) @discord.ext.commands.command(name="stocks.dps.dpotc") async def dpotc(self, ctx: discord.ext.commands.Context, arg): + """Dark pools (ATS) vs OTC data [FINRA]""" await dpotc_command(ctx, arg) @discord.ext.commands.command(name="stocks.dps.spos") async def spos(self, ctx: discord.ext.commands.Context, arg): + """Net short vs position [Stockgrid]""" await spos_command(ctx, arg) @discord.ext.commands.command(name="stocks.dps.psi") async def psi(self, ctx: discord.ext.commands.Context, arg): + """Price vs short interest volume [Stockgrid]""" await psi_command(ctx, arg) @discord.ext.commands.command(name="stocks.dps") async def dark_pool_shorts_menu(self, ctx: discord.ext.commands.Context, arg=""): - """Shows Economy Menu + """Stocks Context - Shows Dark Pool Shorts Menu Returns ------- @@ -103,7 +111,7 @@ class DarkPoolShortsCommands(discord.ext.commands.Cog): return user == ctx.message.author and str(reaction.emoji) in emoji_list try: - reaction, user = await gst_bot.wait_for( + reaction, _ = await gst_bot.wait_for( "reaction_add", timeout=cfg.MENU_TIMEOUT, check=check ) if reaction.emoji == "0️⃣":