@@ -63,21 +63,22 @@ async def format_cog_help(self, cog, *, no_cog=False):
63
63
64
64
embeds = []
65
65
for format_ in formats :
66
- description = cog .description or "No description." \
67
- if not no_cog else "Miscellaneous commands without a category."
68
- embed = Embed (
69
- description = f'*{ description } *' ,
70
- color = bot .main_color ,
66
+ description = (
67
+ cog .description or "No description."
68
+ if not no_cog
69
+ else "Miscellaneous commands without a category."
71
70
)
71
+ embed = Embed (description = f"*{ description } *" , color = bot .main_color )
72
72
73
73
embed .add_field (name = "Commands" , value = format_ or "No commands." )
74
74
75
75
continued = " (Continued)" if embeds else ""
76
- name = cog . qualified_name + " - Help" if not no_cog else "Miscellaneous Commands"
77
- embed . set_author (
78
- name = name + continued ,
79
- icon_url = bot . user . avatar_url ,
76
+ name = (
77
+ cog . qualified_name + " - Help"
78
+ if not no_cog
79
+ else "Miscellaneous Commands"
80
80
)
81
+ embed .set_author (name = name + continued , icon_url = bot .user .avatar_url )
81
82
82
83
embed .set_footer (
83
84
text = f'Type "{ prefix } { self .command_attrs ["name" ]} command" '
@@ -184,8 +185,9 @@ async def send_error_message(self, error):
184
185
command = self .context .kwargs .get ("command" )
185
186
val = self .context .bot .snippets .get (command )
186
187
if val is not None :
187
- return await self .get_destination ().send (escape_mentions (f'**`{ command } ` is a snippet, '
188
- f'content:**\n \n { val } ' ))
188
+ return await self .get_destination ().send (
189
+ escape_mentions (f"**`{ command } ` is a snippet, " f"content:**\n \n { val } " )
190
+ )
189
191
190
192
val = self .context .bot .aliases .get (command )
191
193
if val is not None :
@@ -205,16 +207,16 @@ async def send_error_message(self, error):
205
207
)
206
208
for i , val in enumerate (values , start = 1 ):
207
209
embed .description += f"\n { i } : { escape_markdown (val )} "
208
- embed .set_footer (text = f'Type "{ self .clean_prefix } { self .command_attrs ["name" ]} alias" for more '
209
- 'details on aliases.' )
210
+ embed .set_footer (
211
+ text = f'Type "{ self .clean_prefix } { self .command_attrs ["name" ]} alias" for more '
212
+ "details on aliases."
213
+ )
210
214
return await self .get_destination ().send (embed = embed )
211
215
212
216
logger .warning ("CommandNotFound: %s" , str (error ))
213
217
214
218
embed = Embed (color = Color .red ())
215
- embed .set_footer (
216
- text = f'Command/Category "{ command } " not found.'
217
- )
219
+ embed .set_footer (text = f'Command/Category "{ command } " not found.' )
218
220
219
221
choices = set ()
220
222
@@ -748,10 +750,20 @@ async def config(self, ctx):
748
750
@checks .has_permissions (PermissionLevel .OWNER )
749
751
async def config_options (self , ctx ):
750
752
"""Return a list of valid configuration names you can change."""
751
- allowed = self .bot .config .public_keys
752
- valid = ", " .join (f"`{ k } `" for k in allowed )
753
- embed = Embed (title = "Valid Keys" , description = valid , color = self .bot .main_color )
754
- return await ctx .send (embed = embed )
753
+ embeds = []
754
+ for names in zip_longest (* (iter (sorted (self .bot .config .public_keys )),) * 15 ):
755
+ description = "\n " .join (
756
+ f"`{ name } `" for name in takewhile (lambda x : x is not None , names )
757
+ )
758
+ embed = Embed (
759
+ title = "Available configuration keys:" ,
760
+ color = self .bot .main_color ,
761
+ description = description ,
762
+ )
763
+ embeds .append (embed )
764
+
765
+ session = PaginatorSession (ctx , * embeds )
766
+ await session .run ()
755
767
756
768
@config .command (name = "set" , aliases = ["add" ])
757
769
@checks .has_permissions (PermissionLevel .OWNER )
@@ -784,7 +796,7 @@ async def config_set(self, ctx, key: str.lower, *, value: str):
784
796
785
797
return await ctx .send (embed = embed )
786
798
787
- @config .command (name = "remove" , aliases = ["del" , "delete" , "rm" ])
799
+ @config .command (name = "remove" , aliases = ["del" , "delete" ])
788
800
@checks .has_permissions (PermissionLevel .OWNER )
789
801
async def config_remove (self , ctx , key : str .lower ):
790
802
"""Delete a set configuration variable."""
@@ -867,9 +879,8 @@ async def config_help(self, ctx, key: str.lower):
867
879
return await ctx .send (embed = embed )
868
880
869
881
config_help = self .bot .config .config_help
870
- info = config_help .get (key )
871
882
872
- if info is None :
883
+ if key not in config_help :
873
884
embed = Embed (
874
885
title = "Error" ,
875
886
color = Color .red (),
@@ -880,30 +891,40 @@ async def config_help(self, ctx, key: str.lower):
880
891
def fmt (val ):
881
892
return val .format (prefix = self .bot .prefix , bot = self .bot )
882
893
883
- embed = Embed (
884
- title = f"Configuration description on { key } :" ,
885
- color = self .bot .main_color
886
- )
887
- embed .add_field (name = 'Default:' , value = fmt (info ['default' ]), inline = False )
888
- embed .add_field (name = 'Information:' , value = fmt (info ['description' ]), inline = False )
889
- example_text = ''
890
- for example in info ['examples' ]:
891
- example_text += f'- { fmt (example )} \n '
892
- embed .add_field (name = 'Example(s):' , value = example_text , inline = False )
894
+ index = 0
895
+ embeds = []
896
+ for i , (current_key , info ) in enumerate (config_help .items ()):
897
+ if current_key == key :
898
+ index = i
899
+ embed = Embed (
900
+ title = f"Configuration description on { current_key } :" ,
901
+ color = self .bot .main_color ,
902
+ )
903
+ embed .add_field (name = "Default:" , value = fmt (info ["default" ]), inline = False )
904
+ embed .add_field (
905
+ name = "Information:" , value = fmt (info ["description" ]), inline = False
906
+ )
907
+ example_text = ""
908
+ for example in info ["examples" ]:
909
+ example_text += f"- { fmt (example )} \n "
910
+ embed .add_field (name = "Example(s):" , value = example_text , inline = False )
893
911
894
- note_text = ''
895
- for note in info [' notes' ]:
896
- note_text += f' - { fmt (note )} \n '
897
- if note_text :
898
- embed .add_field (name = ' Note(s):' , value = note_text , inline = False )
912
+ note_text = ""
913
+ for note in info [" notes" ]:
914
+ note_text += f" - { fmt (note )} \n "
915
+ if note_text :
916
+ embed .add_field (name = " Note(s):" , value = note_text , inline = False )
899
917
900
- if info .get (' image' ) is not None :
901
- embed .set_image (url = fmt (info [' image' ]))
918
+ if info .get (" image" ) is not None :
919
+ embed .set_image (url = fmt (info [" image" ]))
902
920
903
- if info .get ('thumbnail' ) is not None :
904
- embed .set_thumbnail (url = fmt (info ['thumbnail' ]))
921
+ if info .get ("thumbnail" ) is not None :
922
+ embed .set_thumbnail (url = fmt (info ["thumbnail" ]))
923
+ embeds += [embed ]
905
924
906
- return await ctx .send (embed = embed )
925
+ paginator = PaginatorSession (ctx , * embeds )
926
+ paginator .current = index
927
+ await paginator .run ()
907
928
908
929
@commands .group (aliases = ["aliases" ], invoke_without_command = True )
909
930
@checks .has_permissions (PermissionLevel .MODERATOR )
@@ -1265,9 +1286,7 @@ async def permissions_add_level(
1265
1286
return await ctx .send (embed = embed )
1266
1287
1267
1288
@permissions .group (
1268
- name = "remove" ,
1269
- aliases = ["del" , "delete" , "rm" , "revoke" ],
1270
- invoke_without_command = True ,
1289
+ name = "remove" , aliases = ["del" , "delete" , "revoke" ], invoke_without_command = True
1271
1290
)
1272
1291
@checks .has_permissions (PermissionLevel .OWNER )
1273
1292
async def permissions_remove (self , ctx ):
0 commit comments