-
Notifications
You must be signed in to change notification settings - Fork 1
feat: complete webhook and add auto assign commands #260
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
base: dev
Are you sure you want to change the base?
Conversation
apps/discord-bot/cogs/general.py
Outdated
| ) | ||
| @app_commands.describe( | ||
| event_id="UUID of event", | ||
| hacker_role="Discord role to assign to hackers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change hacker_role to role
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok some very important things:
Please make sure that this server is checking any newly joined user for our server's guild id (specify in .env file, dont forget to document in .env.example), though a command is still needed for assigning to attendees who have already joined the server, leading to my second point
Please follow proper project structure for completing this functionality. A database connection should not be initialized within this side of the project and proper api routes need to be added so that the database is interfaced with securely.
A database query should be added to the api backend, in which you should add queries to api/internal/db/queries/accounts.sql for retrieving user id from the known discord account id, and add another one to event_roles.sql for retrieving the user's event role from this user id. Afterwards generate the sqlc code so you can interface with these queries using golang, create corresponding functions inside of accounts & event_roles repository and service files, and then hook these up to an api handler function in which you create a protected api route for (see api/internal/api/api.go for examples of what this looks like). Ask me for help on Discord, but you will see the correct patterns if you spend a good amount of time looking at the backend codebase.
You may have some trouble authenticating with the server. Ask Alex how you should go about this since we probably shouldn't your personal cookies made when logging into the app (though this can be a doable workaround for the time being and I'll permit it).
Anyways, for future reference please make sure to test your own code before opening a PR and let us know if you run into any issues while working on a feature with a part of the project which you're unfamiliar with. It is okay if something like this takes time, it needs to be done correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you look over the new implementation. I have created an api endpoint in /api and removed previous unsafe database connections. Currently uses a session_id from personal cookie but i'll ask Alex how to go about different method.
apps/discord-bot/.env.example
Outdated
| DISCORD_TOKEN= | ||
| DISCORD_TOKEN= | ||
| API_KEY= | ||
| GEMINI_API_KEY= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean cmon man this shouldnt be part of our codebase at all...
if you use AI please make sure to clean stuff up before making commits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean the gemini api key? thats for the thread summarizations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. .env.example is used to show environment variables needed for the project to run during development. Gemini should not be required for stuff to run or to develop. You can keep it in your own env file for your own needs, I just don't think there's a need to show it as a required parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holy hell I was not thinking... Apologies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holy hell I was not thinking... Apologies
Description
Linked Jira Ticket
Type of Change
Checklist
Additional Notes