feature (reaction-roles): Configuration command.

New monolithic `rroles` configuration command.
Complete logging and setting implementation in RR tracker.
Improve strings in RR settings.

Add special `NEWPAGE` manual section parsed by the help command.
Add `tabulated` method for `ObjectSettings` for easy display.
Add `_parse_create` switch for the `Role` setting type.
This commit is contained in:
2021-10-18 15:28:14 +03:00
parent 006f2cfd6d
commit cfa3c90841
7 changed files with 912 additions and 265 deletions

View File

@@ -257,6 +257,16 @@ class ObjectSettings:
cls.settings[name] = setting
return setting
def tabulated(self):
"""
Convenience method to provide a complete setting property-table.
"""
formatted = {
setting.display_name: setting.get(self.id, **dict(self.params)).formatted
for name, setting in self.settings.items()
}
return prop_tabulate(*zip(*formatted.items()))
class ColumnData:
"""

View File

@@ -327,6 +327,8 @@ class Role(SettingType):
# Whether to disallow returning roles which don't exist as `discord.Object`s
_strict = True
_parse_create = False
@classmethod
def _data_from_value(cls, id: int, value: Optional[discord.Role], **kwargs):
"""
@@ -370,7 +372,7 @@ class Role(SettingType):
if userstr.lower() in ('0', 'none'):
return None
else:
role = await ctx.find_role(userstr, create=False, interactive=True)
role = await ctx.find_role(userstr, create=cls._parse_create, interactive=True)
if role is None:
raise SafeCancellation
else: