* allow logs feature flag * Adding log collection md * upload last log at startup * additions/refractor * refactor * lint/black ++ * disc * TimeRotating Logger and upload to s3 * corrected regex error * makeup for config * logging/disc/sia/etf/++ * append .log before uploading * process to upload logs to s3 * candle ta/etfmcds * fix * ta candles * implement presignedURL * fixed regex * ma's in 1 cmd, delete older files * refactor ta candle * updates * black * moon? * Logger uploader * rotate every hour * only archive if successful * chavis suggestions * windows * ta * commands_dict update * discord tacmds * log_collection error fix * fix * fix * pylint * bb fix * only log filesize * fixes * discord logs * Delete log_collection.md * fixes for other bots on images * bots image upload fix * updated helpers/load candle * more ta cc/housekeeping/refactors/slashcmds * update bots cmds_dict * adjustments to font size/fixes * test fixs/disc earnings * missed a spot * fixes had > revesred * reversed the >< again oops * remove logger branch code blocking tests * black fix * fix missing sources in docstr/daily candle dt tz * load_candle refactor with docstring * moved insiders to disc * Lucas logging changes * Fixing log_collection.md * testing scenario * more ta converted * more ta * Update config_terminal : remove print of verbosity * table cfg/fix matplt/ screener + * fix * what's sleep? 1 more line.. or 2. scr df2img * juan more. fix news 1m chart issue * ticker.upper() fixes * Update log collection * Updating log collection - change tmp folder Co-authored-by: LBolte29 <lbolte@gmx.net> Co-authored-by: Chavithra PARANA <chavithra@gmail.com> Co-authored-by: LBolte29 <97528701+LBolte29@users.noreply.github.com> Co-authored-by: jose-donato <43375532+jose-donato@users.noreply.github.com> Co-authored-by: didierlopes.eth <dro.lopes@campus.fct.unl.pt>
Discord Bot - WORK IN PROGRESS
Install Requirements
This tutorial assumes that you have successfully installed Gamestonk Terminal.
Next, from the GamestonkTerminal root folder run the following command:
poetry install -E discord
Registering Applications
DISCORD
- Login into your discord account in https://discord.com/developers/applications
- On the "Applications" tab, select "New Application" and name it something like "GST Bot". This will create a new application.
- For creating a bot, we need to go into the "GST Bot" application previously created, and on the "Bot" tab select "Add Bot".
- Allow privileged gateway intents by enabling MESSAGE CONTENT INTENT under the bot tab.
- Next we need to obtain the "Client ID". For that we choose the "OAuth2" tab and copy our "Client ID" under "Client".
- At this stage the bot is created and we are ready to invite it to one of our servers. To do so we need to access: https://discord.com/oauth2/authorize?client_id=CLIENTID&scope=bot%20applications.commands, where CLIENTID is replaced by the value copied above.
- If everything went well, you should see a window popup where the Bot that was just created asks to which of your own servers do you want to add it to.
NOTE: If you haven't managed the bot permissions on the Bot tab previously you can do it via this link generator https://discordapi.com/permissions.html
IMGUR
- Login into your https://imgur.com account. Create one if you don't have it.
- Access https://api.imgur.com/oauth2/addclient to create your application.
- Select "OAuth 2 authorization without a callback URL" when creating such.
- You will receive a client ID and client secret once you submit the form.
NOTE: Registering is free for all open source projects and if your discord bot uses fewer than 1250 uploads per day.
HEROKU
- Replace the general requirements.txt with the one in the discordbot folder.
- Create a Heroku account at: https://signup.heroku.com/.
- Click 'Create a new app'.
- Go to the 'Settings' page, and then find Config Vars.
- Add GT_DISCORD_BOT_TOKEN and GT_IMGUR_CLIENT_ID with their associated values.
- Go to the repository:https://github.com/GamestonkTerminal/GamestonkTerminal and fork it if you have not already done so.
- On the 'Deploy' page select Github as the deployment method.
- Select 'enable automatic deploys' if you would like for the server to update every time you update your fork.
- Go to the 'Resources' tab and turn on the worker by pressing the pencil to edit and then pressing the toggle button.
NOTE: If you only want the bot to run in the cloud you are done, if you would like it to run on your local machine read below.
Discord Configs
In order to config the discord bot you will need to edit the config_discordbot.py file.
-
Edit the path to the terminal by changing the variable
GST_PATH. E.g.GST_PATH = os.path.join("~", "Documents", "GamestonkTerminal") sys.path.append(GST_PATH) -
Update
DISCORD_BOT_TOKENusing discord bot CLIENT ID obtained previously in discord. -
Update
IMGUR_CLIENT_IDusing imgur application CLIENT ID obtained previously in imgur.
Advanced
Other parameters that can be configured are:
- DEBUG: Shows a debug message on the terminal console of what's happening on the discord bot from the server side.
- COMMAND_PREFIX: Command prefix to be used when calling the bot from the discord server.
- DATE_FORMAT: Selects date format to be used as parameter on the discord bot.
- COLOR: Changes color of the bot messages replies on the discord server.
- MENU_TIMEOUT: Timeout in seconds to allow user to select options when a menu command is invoked from the discord bot.
- AUTHOR_NAME: Name of the discord bot in the server.
- AUTHOR_ICON_URL: Icon displayed on the discord bot replies on the server.
Run Locally
Just run the discord bot from this folder with:
uvicorn run_discordbot:app
Now, you should be ready to invoke the discord bot from server using something like:
/cc
Global slash commands can take up to 1 hour to show up after registration
For testing you can change SLASH_TESTING_SERVERS to you server ID in config_discordbot for instant commands availability
To get your server ID:
- Go to settings on your discord app
- Click on Advanced in the APP SETTINGS tab
- Set Developer Mode to on
- Right click on your server's icon on the left hand side and select Copy ID at the bottom
Contributing
See more in CONTRIBUTING.md.
Bugs
If when trying to run the discord bot you receive the following error
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
The solution is to browse to Applications/Python 3.x and double-click Install Certificates.command.
If an error occurs, use DEBUG=True on the config_discordbot.py file.
Then, report what is the issue with the console output attached either by:
- Opening an issue on github
- Contacting either
DidierRLopes(@SexyYear) ornorthern-64bit