Skip to content

Role Selection#1

Open
josecast1 wants to merge 2 commits intoshpe-uf:mainfrom
josecast1:RoleSelection
Open

Role Selection#1
josecast1 wants to merge 2 commits intoshpe-uf:mainfrom
josecast1:RoleSelection

Conversation

@josecast1
Copy link

  • 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

- 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.
@yairtemkin yairtemkin self-requested a review November 15, 2023 03:09
@josecast1 josecast1 requested a review from ernestol7 November 15, 2023 03:10
Copy link
Member

@yairtemkin yairtemkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move intents to a discord.py file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this to match our server

break

if role_selection_message:
print(f'Found existing role selection message: {role_selection_message.jump_url}')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend following the format we have in our server for this message:
image

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!')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!"

@yairtemkin yairtemkin requested review from MATE023, santibarr and yairtemkin and removed request for ernestol7 January 17, 2024 22:18
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