@@ -34,14 +34,27 @@ class BaseMakeApplicantCog(TeXBotBaseCog):
3434 """
3535
3636 async def _perform_make_applicant (
37- self , ctx : "TeXBotApplicationContext" , applicant_member : discord . Member
37+ self , ctx : "TeXBotApplicationContext" , applicant_member_id : int
3838 ) -> None :
3939 """Perform the actual process of making the user into a group-applicant."""
4040 # NOTE: Shortcut accessors are placed at the top of the function so that the exceptions they raise are displayed before any further errors may be sent
4141 main_guild : discord .Guild = ctx .bot .main_guild
4242 applicant_role : discord .Role = await ctx .bot .applicant_role
4343 guest_role : discord .Role = await ctx .bot .guest_role
4444
45+ applicant_member : discord .Member | None = main_guild .get_member (applicant_member_id )
46+
47+ if not applicant_member :
48+ await ctx .respond (
49+ content = (
50+ ":information_source: "
51+ "No changes made. User cannot be made into an applicant "
52+ "because they have left the server :information_source:"
53+ ),
54+ ephemeral = True ,
55+ )
56+ return
57+
4558 if applicant_role in applicant_member .roles :
4659 await ctx .respond ("User is already an applicant! Command aborted." )
4760 return
@@ -198,7 +211,7 @@ async def make_applicant(
198211 await self .command_send_error (ctx , message = member_id_not_integer_error .args [0 ])
199212 return
200213
201- await self ._perform_make_applicant (ctx , applicant_member )
214+ await self ._perform_make_applicant (ctx , applicant_member . id )
202215
203216
204217class MakeApplicantContextCommandsCog (BaseMakeApplicantCog ):
@@ -208,7 +221,7 @@ class MakeApplicantContextCommandsCog(BaseMakeApplicantCog):
208221 @CommandChecks .check_interaction_user_has_committee_role
209222 @CommandChecks .check_interaction_user_in_main_guild
210223 async def user_make_applicant (
211- self , ctx : "TeXBotApplicationContext" , member : discord .Member
224+ self , ctx : "TeXBotApplicationContext" , member : discord .Member | discord . User
212225 ) -> None :
213226 """
214227 Definition and callback response of the "make_applicant" user-context-command.
@@ -217,7 +230,7 @@ async def user_make_applicant(
217230 the "make_applicant" slash-command and thus gives the specified user the
218231 "Applicant" role and removes the "Guest" role if they have it.
219232 """
220- await self ._perform_make_applicant (ctx , member )
233+ await self ._perform_make_applicant (ctx , member . id )
221234
222235 @discord .message_command (name = "Make Message Author Applicant" )
223236 @CommandChecks .check_interaction_user_has_committee_role
@@ -232,19 +245,4 @@ async def message_make_applicant(
232245 the "make_applicant" slash-command and thus gives the specified user the
233246 "Applicant" role and removes the "Guest" role if they have it.
234247 """
235- try :
236- member : discord .Member = await self .bot .get_member_from_str_id (
237- str (message .author .id )
238- )
239- except ValueError :
240- await ctx .respond (
241- content = (
242- ":information_source: "
243- "No changes made. User cannot be made into an applicant "
244- "because they have left the server :information_source:"
245- ),
246- ephemeral = True ,
247- )
248- return
249-
250- await self ._perform_make_applicant (ctx , member )
248+ await self ._perform_make_applicant (ctx , message .author .id )
0 commit comments