Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Discord Bot Code #393

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Updated Discord Bot Code #393

wants to merge 16 commits into from

Conversation

Frank-Lom
Copy link

Removed any references I could find restricting the discord bot to a specific channel.

I swapped it to utilize slash (/) commands and operate under a user installed bot rather than a guild installed bot. Discord has this as an official option when creating a bot and I felt having to have an entire server dedicated for a single bot was unnecessary so now it can be used anywhere at all.
image

All messages are sent with ephemeral set to true if not in DMs with the bot so the bot commands can be executed in literally any server or in a DM with the bot itself and nobody else can see it. If commands are executed in a server, responses for holdings and transactions are DMed to you by the bot instead of sent in the server, even though ephemeral would be set to true so they would be hidden I felt it'd be better to have it in DMs either way.
image

Holdings command is tested and working, Transactions command should function just as normal but have not fully tested since the market is closed. I did try it and it returned errors properly about what ticker I chose, the quantity, and the broker, but it would be worth testing again while the market is open before fully releasing.
image

Dry is set to a default of True for transaction commands unless overrode during executing the command.

Frank-Lom and others added 2 commits October 1, 2024 20:57
Removed any references I could find restricting the discord bot to a specific channel.

I swapped it to utilize slash (/) commands and operate under a user installed bot rather than a guild installed bot. Discord has this as an official option when creating a bot and I felt having to have an entire server dedicated for a single bot was unnecessary so now it can be used anywhere at all.

All messages are sent with ephemeral set to true if not in DMs with the bot so the bot commands can be executed in literally any server or in a DM with the bot itself and nobody else can see it.

If commands are executed in a server, responses for holdings and transactions are DMed to you by the bot instead of sent in the server, even though ephemeral would be set to true so they would be hidden I felt it'd be better to have it in DMs either way.

Holdings command is tested and working, Transactions command should function just as normal but have not fully tested since the market is closed. I did try it and it returned errors properly about what ticker I chose, the quantity, and the broker, but it would be worth testing again while the market is open before fully releasing.

Dry is set to a default of True for transaction commands unless overrode during executing the command.
Update from main branch
@Frank-Lom Frank-Lom marked this pull request as ready for review October 2, 2024 02:04
@NelsonDane
Copy link
Owner

Wow, thanks for the PR! If this requires changes to the setup instructions (guides/discordBot.md), the .env (.env.example), or the Readme, please update those too

Frank-Lom and others added 5 commits October 2, 2024 09:58
Updated guides and example env file
Added a /dm command to start a dm with the bot if needed
Removed unused DISCORD_CHANNEL variable from example env
Added dry default state to env file so it can be defaulted to whatever the user wants (DISCORD BOT ONLY)
Trimmed leftover whitespace
Removed unused imports
Adjusted line spacing
Removed default dry toggle
Ping command now dms user so no need for /dm
@matthew55 matthew55 added the enhancement New feature or request label Oct 3, 2024
@NelsonDane
Copy link
Owner

This has been working well for me, would love some input from @ImNotOssy @matthew55

Since it changes a lot we definitely want some thorough testing.

@ImNotOssy
Copy link
Contributor

This has been working well for me, would love some input from @ImNotOssy @matthew55

Since it changes a lot we definitely want some thorough testing.

will doo, i had already implemented something like this into my own custom bot but decided against pushing a pull request since "users dont like slash commands" or something idk what nelson had said about it.
image
image
i added a User ID check (prevents other accounts from messaging the bot and sending commands to it)
changes the image to whatever i want at bot startup, and changes the name of the bot to the current channel name (i run for multiple clients makes it easier to differentiate who im trading for)
I like the message the bot in DM's makes it more private, for my use case i dont pefer the ephemeral set to true when in discord server since i also want to be transparent to my clients about what trades im doing and they can see chat history (when i ran trades) but for a normal user use this is fine.

Over all great ideas, i will look more into what features have been added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants