Skip to content

Conversation

@SobaSkee
Copy link
Collaborator

Description

  • Created a webhook for the discord bot that accepts as parameters: user_id, role_name, guild_id
  • Created a discord bot command called assign_hacker_roles that queries database for all users with event_role == attending and then iterates over discord server to add a specified role to users without that role
  • Added another utility command to remove a specified role from all users in the server in case the role above messes things up

Linked Jira Ticket

Type of Change

Checklist

  • My code follows the project's style guidelines
  • I have commented on complex parts of the code
  • I have updated documentation if necessary
  • I have updated or added tests to cover my changes
  • I have updated the OpenAPI YAML or other API schema files if applicable

Additional Notes

)
@app_commands.describe(
event_id="UUID of event",
hacker_role="Discord role to assign to hackers"
Copy link
Collaborator

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

Copy link
Collaborator

@h1divp h1divp Dec 26, 2025

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.

Copy link
Collaborator Author

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.

DISCORD_TOKEN=
DISCORD_TOKEN=
API_KEY=
GEMINI_API_KEY=
Copy link
Collaborator

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

Copy link
Collaborator Author

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

Copy link
Collaborator

@h1divp h1divp Dec 27, 2025

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

Copy link
Collaborator

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

Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants