Conversation
- Made the discord bot display a role selection message with custom server emoji reactions corresponding to the roles. - Users are able to add the custom server emoji reactions to the message for the role they want in the role-selection channel of the discord server. - The bot also PM's the user a description of the role they selected as well as notifying them if they removed a role.
There was a problem hiding this comment.
Hey Jose! Overall, your code looks really good! I made a few comments for you to correct and update in this PR. Main things are:
- separating our code base for better readability
- updating content to match current server content
- update printing to logging
Also, I strongly consider looking into how we can test these functions. I know its a bit tricky given the unique inputs but worth testing regardless.
if you have any questions, please let me know!
| ) | ||
|
|
||
| # Custom emojis id's and role names dictionary | ||
| emoji_to_role = { |
There was a problem hiding this comment.
I see this was reused in several places. Can we move it to a separate location or to the top of our file?
Also, please update these icons and roles to match those of our server
| if role: | ||
| await user.add_roles(role) | ||
|
|
||
| if role_name == 'Computer Role': |
There was a problem hiding this comment.
We should update these regarding our server roles as well
| await user.remove_roles(role) | ||
| await user.send(f'You have removed the {role_name}.') | ||
|
|
||
| client.run('MTE1NTcxMzExMzQ4MDUwMzMwNg.GBV3E-.XAzKwGbju8cjOeS7uLq3yz2rfhvAp669Lqg-4Y') No newline at end of file |
There was a problem hiding this comment.
I'd recommend moving this to a general discord.py file that initializes our bot.
Also, investigate how we can import this file/ its functions into the discord.py to be used.
| import discord | ||
| from discord.ext import commands | ||
|
|
||
| intents = discord.Intents.default() |
There was a problem hiding this comment.
Move intents to a discord.py file
There was a problem hiding this comment.
Please create a discord.py file and move the intents there.
| print(f'Logged in as {client.user.name}') | ||
|
|
||
| # Find "roles-selection" channel | ||
| role_selection_channel = discord.utils.get(client.guilds[1].text_channels, name="roles-selection") |
There was a problem hiding this comment.
Update this to match our server
| break | ||
|
|
||
| if role_selection_message: | ||
| print(f'Found existing role selection message: {role_selection_message.jump_url}') |
There was a problem hiding this comment.
consider changing print statements to log statements: https://docs.python.org/3/howto/logging.html
| else: | ||
| # Create a new role selection embed message | ||
| embed = discord.Embed( | ||
| title="Role Selection:", |
| await user.add_roles(role) | ||
|
|
||
| if role_name == 'Computer Role': | ||
| await user.send('You selected the Computer Role! You will be coding and gaining experience on how computers function!') |
There was a problem hiding this comment.
I'd update these messages as well. I'll list them out for each role:
Autonomous Vehicle Design Teams:
- "You have been assigned the Autonomous Vehicle Design Team role! Here you can find the latest updates on our Autonomous Vehcile projects. If you are a member for this project, please reach out to Lorenz Carvajal or Alex Lyew to join your team's channels!"
Kotlin App:
- "You have been assigned the Kotlin App role! Here you can find the latest updates on our Android Mobile App project. If you are a member for this project, please reach out to Miguel Tejeda to join your team's channels!"
Swift App:
- "You have been assigned the Swift App role! Here you can find the latest updates on our iOS Mobile App project. If you are a member for this project, please reach out to Jesus Lopez to join your team's channels!"
Interview Prep:
- "You have been assigned the Interview Prep role! Here you can join us in our technical prep office hours, sign up for mock interviews and solve a LeetCode Question of the Week. If you have any questions, feel free to reach out to Mateo Slivka, Santiago Barrios or Diego Santos Gonzalez!"

Made the discord bot display a role selection message with custom server emoji reactions corresponding to the roles.
Users are able to add the custom server emoji reactions to the message for the role they want in the role-selection channel of the discord server.
The bot also PM's the user a description of the role they selected as well as notifying them if they removed a role.
Summary
please explain what your PR does here. screenshots are especially helpful.
Reference
Reference your Asana task here as shown below
Asana link
Extra
please request your fellow developer or Yair as a reviewer. thank u