feature (sponsors): Add sponsor command.

Add new sponsor prompts.
Add new sponsor command.
Add `sponsor_text` table.
Add sponsor global config settings.
Update `Setting.command` to use new `widget`.
Add custom `cmd_str` support to `Message` `SettingType`.
This commit is contained in:
2022-03-12 17:27:25 +02:00
parent 826734e772
commit da9f9b02b1
11 changed files with 170 additions and 10 deletions

View File

@@ -201,13 +201,13 @@ class Setting:
raise NotImplementedError
@classmethod
async def command(cls, ctx, id):
async def command(cls, ctx, id, flags=()):
"""
Standardised command viewing/setting interface for the setting.
"""
if not ctx.args:
if not ctx.args and not ctx.msg.attachments:
# View config embed for provided cls
await ctx.reply(embed=cls.get(id).embed)
await cls.get(id).widget(ctx, flags=flags)
else:
# Check the write ward
if cls.write_ward and not await cls.write_ward.run(ctx):

View File

@@ -713,6 +713,8 @@ class Message(SettingType):
_substitution_desc = {
}
_cmd_str = '{prefix} config {setting}'
@classmethod
def _data_from_value(cls, id, value, **kwargs):
if value is None:
@@ -844,14 +846,16 @@ class Message(SettingType):
embed.add_field(
name="Setting Guide",
value=(
"• For plain text without an embed, use `{prefix}config {setting} <text>`.\n"
"• For plain text without an embed, use `{cmd_str} <text>`.\n"
"• To include an embed, build the message [here]({builder}) "
"and upload the json code as a file with the `{prefix}config {setting}` command.\n"
"• To reset the message to the default, use `{prefix}config {setting} None`."
"and upload the json code as a file with the `{cmd_str}` command.\n"
"• To reset the message to the default, use `{cmd_str} None`."
).format(
cmd_str=self._cmd_str,
builder="https://glitchii.github.io/embedbuilder/?editor=gui"
).format(
prefix=ctx.best_prefix,
setting=self.display_name,
builder="https://glitchii.github.io/embedbuilder/?editor=gui"
),
inline=False
)