Files
OpenBB/discordbot/generic_commands.py
Theodore Aptekarev 17c9b01fad Bot UX playground (#1082)
* Minify the help command

* Add help command for the dps menu

* Blacker the black code

* Add bot log handling

* improve screener on discordbot

* improve screener code of discordbot

* linter

* line length

* fix bug with window size on discordbot

* pylint and black fixes

* black linter

* fix and improve options menu

* Add usage example and fall back to using docstrings as help messages

* Make logger create new files on every launch

* Add usage instructions to menus and commands

* Update docstrings

* Fix arktrades command not handling limit numbers

* Add forgotten help message to the economy command

* Send "you snooze you loose" message only if debug flag is on

Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
2021-12-23 21:30:50 +00:00

89 lines
3.1 KiB
Python

import discord
import discordbot.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
bot.help_command.cog = self
def cog_unload(self):
self.bot.help_command = None
@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)
@discord.ext.commands.command(name="usage")
async def usage(self, ctx: discord.ext.commands.Context):
usage_instructions_message = """
```
- Every command starts with an exclamation point "!".
- Any command can be triggered from the chat. For example:
!about
or
!stocks.dps.spos tsla
or
!stocks.ta.recom tsla
- Help is available for all menus and functions.
Call help for individual menus like this:
!help DarkPoolShortsCommands
Call help for individual commands like this:
!help stocks.dps
- Call the help command to see the list of available menus:
!help
```
"""
await ctx.send(usage_instructions_message)
def setup(bot: discord.ext.commands.Bot):
bot.add_cog(GenericCommands(bot))