@@ -48,6 +48,9 @@ async def modset_showsettings(self, ctx: commands.Context):
4848 dm_on_kickban = data ["dm_on_kickban" ]
4949 default_days = data ["default_days" ]
5050 default_tempban_duration = data ["default_tempban_duration" ]
51+ ban_show_extra = data ["ban_show_extra" ]
52+ ban_extra_embed_title = data ["ban_extra_embed_title" ]
53+ ban_extra_embed_contents = data ["ban_extra_embed_contents" ]
5154 if not track_all_names and track_nicknames :
5255 yes_or_no = _ ("Overridden by another setting" )
5356 else :
@@ -98,9 +101,18 @@ async def modset_showsettings(self, ctx: commands.Context):
98101 )
99102 else :
100103 msg += _ ("Default message history delete on ban: Don't delete any\n " )
101- msg += _ ("Default tempban duration: {duration}" ).format (
104+ msg += _ ("Default tempban duration: {duration}\n " ).format (
102105 duration = humanize_timedelta (seconds = default_tempban_duration )
103106 )
107+ msg += _ ("Show optional information field in embed: {yes_or_no}\n " ).format (
108+ yes_or_no = _ ("Yes" ) if ban_show_extra else _ ("No" )
109+ )
110+ msg += _ ("Title of the optional extra field: {ban_embed_title}\n " ).format (
111+ ban_embed_title = ban_extra_embed_title if ban_extra_embed_title else _ ("None" )
112+ )
113+ msg += _ ("Contents of the optional extra field: {ban_embed_contents}" ).format (
114+ ban_embed_contents = ban_extra_embed_contents if ban_extra_embed_contents else _ ("None" )
115+ )
104116 await ctx .send (box (msg ))
105117
106118 @modset .command ()
@@ -347,9 +359,15 @@ async def reinvite(self, ctx: commands.Context):
347359 )
348360 )
349361
350- @modset .command ()
362+ @modset .group ()
351363 @commands .guild_only ()
352- async def dm (self , ctx : commands .Context , enabled : bool = None ):
364+ async def dm (self , ctx : commands .Context ):
365+ """
366+ Settings for messaging the user when being kicked or banned.
367+ """
368+
369+ @dm .command (name = "sendmessage" )
370+ async def dm_sendmessage (self , ctx : commands .Context , enabled : bool = None ):
353371 """Toggle whether a message should be sent to a user when they are kicked/banned.
354372
355373 If this option is enabled, the bot will attempt to DM the user with the guild name
@@ -370,6 +388,63 @@ async def dm(self, ctx: commands.Context, enabled: bool = None):
370388 _ ("Bot will no longer attempt to send a DM to user before kick and ban." )
371389 )
372390
391+ @dm .command (name = "banshowextrafield" )
392+ async def dm_banshowextrafield (self , ctx : commands .Context , enabled : bool = None ):
393+ """
394+ Toggle whether to show an extra customizable field when banning.
395+
396+ This can be used to add additional information for the banned user, such as a ban appeal link.
397+ """
398+ guild = ctx .guild
399+ if enabled is None :
400+ setting = await self .config .guild (guild ).ban_show_extra ()
401+ await ctx .send (
402+ _ ("The extra embed field is currently set to: {setting}" ).format (setting = setting )
403+ )
404+ return
405+ await self .config .guild (guild ).ban_show_extra .set (enabled )
406+ if enabled :
407+ await ctx .send (
408+ _ (
409+ "An extra field will be shown when banning. Configure it with `{prefix}modset dm banextrafieldtitle` and `{prefix}modset dm banextrafieldcontents`"
410+ ).format (prefix = ctx .prefix )
411+ )
412+ else :
413+ await ctx .send (_ ("An extra field will be no longer be shown when banning." ))
414+
415+ @dm .command (name = "banextrafieldtitle" )
416+ async def dm_banextrafieldtitle (self , ctx : commands .Context , * , title : str ) -> None :
417+ """
418+ Set the title for the optional extra embed on ban.
419+
420+ Cannot be over 252 characters long.
421+ """
422+ guild = ctx .guild
423+ # Bolding the text is 4 characters (**bolded**)
424+ # All the bold function used in the embeds does is add those star characters and some other convenience stuffs.
425+ # Such as escaping formatting.
426+ if len (title ) > 252 :
427+ await ctx .send (_ ("Embed title cannot be over 252 characters long." ))
428+ else :
429+ await self .config .guild (guild ).ban_extra_embed_title .set (title )
430+ await ctx .send (_ ("Embed Title has been set to `{title}`" ).format (title = title ))
431+
432+ @dm .command (name = "banextrafieldcontents" )
433+ async def dm_banextrafieldcontents (self , ctx : commands .Context , * , contents : str ) -> None :
434+ """
435+ Set the contents for the optional extra embed on ban
436+
437+ Cannot be over 1024 characters long.
438+ """
439+ guild = ctx .guild
440+ if len (contents ) > 1024 :
441+ await ctx .send (_ ("Embed contents cannot be over 1024 characters long." ))
442+ else :
443+ await self .config .guild (guild ).ban_extra_embed_contents .set (contents )
444+ await ctx .send (
445+ _ ("Embed Contents has been set to `{contents}`" ).format (contents = contents )
446+ )
447+
373448 @modset .command ()
374449 @commands .guild_only ()
375450 async def requirereason (self , ctx : commands .Context , enabled : bool = None ):
0 commit comments