@@ -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
@@ -196,7 +209,7 @@ async def make_applicant(
196209 await self .command_send_error (ctx , message = member_id_not_integer_error .args [0 ])
197210 return
198211
199- await self ._perform_make_applicant (ctx , applicant_member )
212+ await self ._perform_make_applicant (ctx , applicant_member . id )
200213
201214
202215class MakeApplicantContextCommandsCog (BaseMakeApplicantCog ):
@@ -206,7 +219,7 @@ class MakeApplicantContextCommandsCog(BaseMakeApplicantCog):
206219 @CommandChecks .check_interaction_user_has_committee_role
207220 @CommandChecks .check_interaction_user_in_main_guild
208221 async def user_make_applicant (
209- self , ctx : "TeXBotApplicationContext" , member : discord .Member
222+ self , ctx : "TeXBotApplicationContext" , member : discord .Member | discord . User
210223 ) -> None :
211224 """
212225 Definition and callback response of the "make_applicant" user-context-command.
@@ -215,7 +228,7 @@ async def user_make_applicant(
215228 the "make_applicant" slash-command and thus gives the specified user the
216229 "Applicant" role and removes the "Guest" role if they have it.
217230 """
218- await self ._perform_make_applicant (ctx , member )
231+ await self ._perform_make_applicant (ctx , member . id )
219232
220233 @discord .message_command (name = "Make Message Author Applicant" )
221234 @CommandChecks .check_interaction_user_has_committee_role
@@ -230,19 +243,4 @@ async def message_make_applicant(
230243 the "make_applicant" slash-command and thus gives the specified user the
231244 "Applicant" role and removes the "Guest" role if they have it.
232245 """
233- try :
234- member : discord .Member = await self .bot .get_member_from_str_id (
235- str (message .author .id )
236- )
237- except ValueError :
238- await ctx .respond (
239- content = (
240- ":information_source: "
241- "No changes made. User cannot be made into an applicant "
242- "because they have left the server :information_source:"
243- ),
244- ephemeral = True ,
245- )
246- return
247-
248- await self ._perform_make_applicant (ctx , member )
246+ await self ._perform_make_applicant (ctx , message .author .id )
0 commit comments